Update state in a event listener #1788
-
Reproductionhttps://codesandbox.io/s/hardcore-brattain-l2z1tl?file=/src/main.js Steps to reproduce the bugI moved from Vuex (where this scenario worked) to Pinia. The issue is that it is not updating the state in the event listener. I build a simple project on CodeSandBox which simulate the issue I have on my own project. Go to the link provided on top. Recommend to be in a chrome browser (with voice recognition support) and open the web in a new tab. Expected behaviorUpdate the state in this case Actual behaviorIt won't update the state. Additional informationUsing Vue 2 and latest Pinia version |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I found a few issues in your code:
I would also recommend you to update your vue dependencies (e.g vue 2.7), there seem to be a few bugs related to the outdated version |
Beta Was this translation helpful? Give feedback.
I found a few issues in your code:
this
inside a callback, you need to use the arrow function to preserve the context:I would also recommend you to update your vue dependencies (e.g vue 2.7), there seem to be a few bugs related to the outdated version