Skip to content

Commit a374438

Browse files
committed
1 parent de61e06 commit a374438

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/backend/vuex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ export function initVuexBackend (hook, bridge) {
2121

2222
// devtool -> application
2323
bridge.on('vuex:travel-to-state', state => {
24-
hook.emit('vuex:travel-to-state', parse(state))
24+
hook.emit('vuex:travel-to-state', parse(state, true /* revive */))
2525
})
2626
}

src/util.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,20 @@ function replacer (key, val) {
5252
}
5353
}
5454

55-
export function parse (data, revivier) {
56-
return CircularJSON.parse(data, revivier)
55+
export function parse (data, revive) {
56+
return revive
57+
? CircularJSON.parse(data, reviver)
58+
: CircularJSON.parse(data)
59+
}
60+
61+
function reviver (key, val) {
62+
if (val === UNDEFINED) {
63+
return undefined
64+
} else if (val === INFINITY) {
65+
return Infinity
66+
} else {
67+
return val
68+
}
5769
}
5870

5971
/**

0 commit comments

Comments
 (0)