Skip to content

Commit

Permalink
fix(vuex): inspect state not working when history is filtered
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Feb 3, 2019
1 parent 118a37f commit 8167e3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/devtools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function initApp (shell) {

if (index === -1) {
store.commit('vuex/UPDATE_BASE_STATE', snapshot)
} else if (store.state.vuex.inspectedIndex === index) {
} else if (store.getters['vuex/absoluteInspectedIndex'] === index) {
store.commit('vuex/UPDATE_INSPECTED_STATE', snapshot)
}

Expand Down
8 changes: 8 additions & 0 deletions src/devtools/views/vuex/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ const getters = {

filteredHistory ({ history, filterRegex }) {
return history.filter(entry => filterRegex.test(entry.mutation.type))
},

absoluteInspectedIndex ({ history, inspectedIndex }, { filteredHistory }) {
const entry = filteredHistory[inspectedIndex]
if (entry) {
return history.indexOf(entry)
}
return -1
}
}

Expand Down

0 comments on commit 8167e3c

Please sign in to comment.