Skip to content

Commit 6da6377

Browse files
tsoftware-orgiksim
authored andcommitted
fix: browser env mutation.handlers is undefined (vuejs#892)
* Fix browser env mutation.handlers is undefined In the latest Firefox and Google browsers, state data tree will not load for error:[mutation.handlers is undefined], because mutation handler actually passes is null (store. _mutations is empty) while pushing the handlers value as an element to the base mutations array, just add robust check. * Fix CI lint space problem
1 parent 2150bda commit 6da6377

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/vuex.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ export function initVuexBackend (hook, bridge) {
146146
// Replay mutations
147147
for (let i = snapshot.index + 1; i <= index; i++) {
148148
const mutation = mutations[i]
149-
mutation.handlers.forEach(handler => handler(mutation.payload))
149+
if (mutation.handlers) {
150+
mutation.handlers.forEach(handler => handler(mutation.payload))
151+
}
152+
150153
if (i !== index && i % SharedData.cacheVuexSnapshotsEvery === 0) {
151154
takeSnapshot(i, state)
152155
}

0 commit comments

Comments
 (0)