Skip to content

Commit 97e6af5

Browse files
author
Guillaume Chau
committed
fix(vuex): clone module state instead of stringify
1 parent 3670e8f commit 97e6af5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/backend/vuex.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ export function initVuexBackend (hook, bridge, isLegacy) {
7474
...options,
7575
preserveState: false
7676
},
77-
state: stringify(state)
77+
state: clone(state, {
78+
includeNonEnumerable: true
79+
})
7880
}
7981

8082
if (SharedData.recordVuex) {
@@ -283,7 +285,7 @@ export function initVuexBackend (hook, bridge, isLegacy) {
283285
tempAddedModules.push(key)
284286
origRegisterModule(moduleInfo.path, {
285287
...moduleInfo.module,
286-
state: parse(moduleInfo.state, true)
288+
state: moduleInfo.state
287289
}, moduleInfo.options)
288290
updateSnapshotsVm(store.state)
289291
if (!isProd) console.log('replay register module', moduleInfo)
@@ -340,7 +342,7 @@ export function initVuexBackend (hook, bridge, isLegacy) {
340342
const { path, module, options, state } = registeredModules[m]
341343
origRegisterModule(path, {
342344
...module,
343-
state: parse(state, true)
345+
state
344346
}, options)
345347
if (!isProd) console.log('after replay register', m)
346348
})
@@ -404,7 +406,7 @@ export function initVuexBackend (hook, bridge, isLegacy) {
404406
const { path, module, options, state } = data
405407
origRegisterModule(path, {
406408
...module,
407-
state: parse(state, true)
409+
state
408410
}, options)
409411
registeredModules[path.join('/')] = data
410412
}

0 commit comments

Comments
 (0)