File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ export default {
28
28
count : state => state .count
29
29
})
30
30
},
31
+ watch: {
32
+ count (value ) {
33
+ console .log (' %ccount new value' , ' font-weight: bold;' , value)
34
+ }
35
+ },
31
36
methods: {
32
37
increment () {
33
38
this .$store .commit (' INCREMENT' , { a: 1 , b: { c: 3 }})
Original file line number Diff line number Diff line change 1
1
import { stringify , parse } from 'src/util'
2
2
import SharedData from 'src/shared-data'
3
3
import { set } from '../util'
4
+ import Vue from 'vue'
4
5
5
6
export function initVuexBackend ( hook , bridge ) {
6
7
const store = hook . store
8
+ console . log ( store )
9
+
10
+ let originalVm = store . _vm
11
+ const snapshotsVm = new Vue ( {
12
+ data : {
13
+ $$state : { }
14
+ } ,
15
+ computed : originalVm . $options . computed
16
+ } )
7
17
8
18
const getSnapshot = ( ) => stringify ( {
9
19
state : store . state ,
@@ -103,7 +113,7 @@ export function initVuexBackend (hook, bridge) {
103
113
} )
104
114
105
115
function replayMutations ( index ) {
106
- const currentState = store . state
116
+ store . _vm = snapshotsVm
107
117
108
118
// Get most recent snapshot for target index
109
119
// for faster replay
@@ -155,7 +165,7 @@ export function initVuexBackend (hook, bridge) {
155
165
lastState = resultState
156
166
157
167
// Restore user state
158
- store . replaceState ( currentState )
168
+ store . _vm = originalVm
159
169
160
170
return resultState
161
171
}
You can’t perform that action at this time.
0 commit comments