File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
packages/app-backend-vue2/src Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ export const backend: DevtoolsBackend = {
76
76
const { Vue } = appRecord . options . meta
77
77
const app = appRecord . options . app
78
78
wrapVueForEvents ( app , Vue , api . ctx )
79
- setupPlugin ( api , app )
79
+ setupPlugin ( api , app , Vue )
80
80
}
81
81
}
82
82
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import copy from 'clone-deep'
5
5
6
6
let actionId = 0
7
7
8
- export function setupPlugin ( api : DevtoolsApi , app : App ) {
8
+ export function setupPlugin ( api : DevtoolsApi , app : App , Vue ) {
9
9
const ROUTER_INSPECTOR_ID = 'vue2-router-inspector'
10
10
const ROUTER_CHANGES_LAYER_ID = 'vue2-router-changes'
11
11
@@ -198,6 +198,29 @@ export function setupPlugin (api: DevtoolsApi, app: App) {
198
198
} )
199
199
}
200
200
} , { prepend : true } )
201
+
202
+ // Inspect getters on mutations
203
+ api . on . inspectTimelineEvent ( payload => {
204
+ if ( payload . layerId === VUEX_MUTATIONS_ID ) {
205
+ const getterKeys = Object . keys ( store . getters )
206
+ if ( getterKeys . length ) {
207
+ const vm = new Vue ( {
208
+ data : {
209
+ $$state : payload . data . state
210
+ } ,
211
+ computed : store . _vm . $options . computed
212
+ } )
213
+ const originalVm = store . _vm
214
+ store . _vm = vm
215
+
216
+ const tree = transformPathsToObjectTree ( store . getters )
217
+ payload . data . getters = copy ( tree )
218
+
219
+ store . _vm = originalVm
220
+ vm . $destroy ( )
221
+ }
222
+ }
223
+ } )
201
224
}
202
225
} )
203
226
}
You can’t perform that action at this time.
0 commit comments