File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -125,10 +125,10 @@ function connect (Vue) {
125
125
126
126
// vuex
127
127
if ( hook . store ) {
128
- initVuexBackend ( hook , bridge )
128
+ initVuexBackend ( hook , bridge , isLegacy )
129
129
} else {
130
130
hook . once ( 'vuex:init' , store => {
131
- initVuexBackend ( hook , bridge )
131
+ initVuexBackend ( hook , bridge , isLegacy )
132
132
} )
133
133
}
134
134
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import SharedData from 'src/shared-data'
3
3
import { set } from '../util'
4
4
import Vue from 'vue'
5
5
6
- export function initVuexBackend ( hook , bridge ) {
6
+ export function initVuexBackend ( hook , bridge , isLegacy ) {
7
7
const store = hook . store
8
8
9
9
let originalVm = store . _vm
@@ -147,7 +147,16 @@ export function initVuexBackend (hook, bridge) {
147
147
for ( let i = snapshot . index + 1 ; i <= index ; i ++ ) {
148
148
const mutation = mutations [ i ]
149
149
if ( mutation . handlers ) {
150
- mutation . handlers . forEach ( handler => handler ( mutation . payload ) )
150
+ if ( Array . isArray ( mutation . handlers ) ) {
151
+ mutation . handlers . forEach ( handler => handler ( mutation . payload ) )
152
+ } else {
153
+ if ( isLegacy ) {
154
+ // Vuex 1
155
+ mutation . handlers ( store . state , mutation . payload )
156
+ } else {
157
+ mutation . handlers ( mutation . payload )
158
+ }
159
+ }
151
160
}
152
161
153
162
if ( i !== index && i % SharedData . cacheVuexSnapshotsEvery === 0 ) {
You can’t perform that action at this time.
0 commit comments