Skip to content

Commit c7988db

Browse files
author
Guillaume Chau
committed
fix(vuex): saved snapshots use clone instead of stringify
1 parent 24a8157 commit c7988db

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/vuex.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function initVuexBackend (hook, bridge, isLegacy) {
1919
})
2020
}
2121

22-
const getStateSnapshot = (_store = store) => stringify(_store.state)
22+
const getStateSnapshot = (_store = store) => clone(_store.state)
2323

2424
let baseStateSnapshot, stateSnapshots, mutations, lastState
2525
let registeredModules = {}
@@ -163,7 +163,7 @@ export function initVuexBackend (hook, bridge, isLegacy) {
163163
// devtool -> application
164164
bridge.on('vuex:travel-to-state', ({ index, apply }) => {
165165
const snapshot = replayMutations(index)
166-
const { state } = parse(snapshot, true)
166+
const { state } = clone(snapshot)
167167
bridge.send('vuex:inspected-state', {
168168
index,
169169
snapshot
@@ -249,7 +249,7 @@ export function initVuexBackend (hook, bridge, isLegacy) {
249249
if (stateSnapshot.index === index) {
250250
resultState = stateSnapshot.state
251251

252-
const state = parse(stateSnapshot.state, true)
252+
const state = clone(stateSnapshot.state)
253253
updateSnapshotsVm(state)
254254
store.replaceState(state)
255255
} else {
@@ -265,7 +265,7 @@ export function initVuexBackend (hook, bridge, isLegacy) {
265265
if (!isProd) console.log('before replay unregister', m)
266266
})
267267

268-
const state = parse(stateSnapshot.state, true)
268+
const state = clone(stateSnapshot.state)
269269
updateSnapshotsVm(state)
270270
store.replaceState(state)
271271

@@ -377,7 +377,7 @@ export function initVuexBackend (hook, bridge, isLegacy) {
377377
if (stateSnapshot) {
378378
originalVm = store._vm
379379
store._vm = snapshotsVm
380-
store.replaceState(parse(stateSnapshot, true))
380+
store.replaceState(clone(stateSnapshot))
381381
}
382382

383383
const result = stringify({

0 commit comments

Comments
 (0)