Skip to content

Commit e27c663

Browse files
Guillaume Chauiksim
authored andcommitted
fix(vuex): inspect state not working when history is filtered
1 parent afe86a2 commit e27c663

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/devtools/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function initApp (shell) {
147147

148148
if (index === -1) {
149149
store.commit('vuex/UPDATE_BASE_STATE', snapshot)
150-
} else if (store.state.vuex.inspectedIndex === index) {
150+
} else if (store.getters['vuex/absoluteInspectedIndex'] === index) {
151151
store.commit('vuex/UPDATE_INSPECTED_STATE', snapshot)
152152
}
153153

src/devtools/views/vuex/module.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ const getters = {
138138

139139
filteredHistory ({ history, filterRegex }) {
140140
return history.filter(entry => filterRegex.test(entry.mutation.type))
141+
},
142+
143+
absoluteInspectedIndex ({ history, inspectedIndex }, { filteredHistory }) {
144+
const entry = filteredHistory[inspectedIndex]
145+
if (entry) {
146+
return history.indexOf(entry)
147+
}
148+
return -1
141149
}
142150
}
143151

0 commit comments

Comments
 (0)