vuejs / devtools-v6

⚙️ Browser devtools extension for debugging Vue.js applications.
https://devtools-v6.vuejs.org/
MIT License
24.68k stars 4.14k forks source link

Vuex tools not updating with onchange event handler in mutation #382

Closed ghost closed 7 years ago

ghost commented 7 years ago

So, i have an app that makes use of screenfull javascript library to toggle fullscreen on and off and in order to do this i've set up my global vuex store as follows

export default new Vuex.Store({
  state: {
    fullscreen: false
  },
  getters: {
    fullscreen: state => state.fullscreen
  },
  mutations: {
    toogleFullscreen(state) {
      screenHandler.toggle()
      screenHandler.onchange(() => {
        state.fullscreen = screenHandler.isFullscreen
      })
    }
  }
})

I've console logged the results and, as expected it returns true, false, true, false etc... however when i look at vue devtools it never seems to get past false, even if i keep refreshing it. Now, it works if i press the button in my app which triggers the mutation, but the onchange event listener is set up to change the state, why doesn't that appear in the dev tools?

I need the onchange hook because in this case fullscreen mode allows you to quit by pressing esc and i need to be able to change my state based on that event.

posva commented 7 years ago

Hey, can you boil down the error and provide a repro using this template? Thanks!

posva commented 7 years ago

Closing due to inactivity. Please open a new issue with a reference to this one if you can follow up with more information.