From 8167e3c8610b1509dea6fdf6888f3222f7210dd1 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sun, 3 Feb 2019 13:51:12 +0100 Subject: [PATCH] fix(vuex): inspect state not working when history is filtered --- src/devtools/index.js | 2 +- src/devtools/views/vuex/module.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/devtools/index.js b/src/devtools/index.js index 3d764fbad..a8f06869d 100644 --- a/src/devtools/index.js +++ b/src/devtools/index.js @@ -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) } diff --git a/src/devtools/views/vuex/module.js b/src/devtools/views/vuex/module.js index 5fb4995a5..1aef489ba 100644 --- a/src/devtools/views/vuex/module.js +++ b/src/devtools/views/vuex/module.js @@ -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 } }