Property in store is not reactive #2030
-
Reproductionhttps://stackblitz.com/edit/github-nu748r?file=src%2FApp.vue Steps to reproduce the bug
The corresponding code is: const store = usePeopleStore();
// This watch doesn't work. store.peopleCount is not reactive.
// It is my understanding that the state properties are reactive.
// Bug?
watch(store.peopleCount, (newVal) => {
console.log('peopleCount changed: %d', newVal);
}); Expected behaviorThe call to Actual behaviorThe Additional informationSo far, I have written this bug report from the "Pinia's store property is not reactive" standpoint, but it so happens that direct assignment of the store property seems to trigger the reactive nature. So, bug in Pinia? Or in Vue's |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
It's watch(() => store.peopleCount, (newVal) => {
console.log('peopleCount changed: %d', newVal);
}); |
Beta Was this translation helpful? Give feedback.
-
Hey, I have a question, if you all don't mind, related to my initial topic. I see the following in the Vue devtools: As pointed out by the red arrow, Vue devtools seems to be telling me that the |
Beta Was this translation helpful? Give feedback.
It's