Vue3's recent update causing "dirty computed getter" warning due to some inner workings of useStore() with mapState()
#2585
-
Paraphrase: when a readonly computed getter contains useStore(), vue3 throws a warning about self-triggering computed getters. here's the warning: |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 9 replies
-
Hello, I am providing this example, where the warning is being generated. export const useExampleStore = defineStore({
id: "example",
state: () => ({
foo: "foo value"
}),
getters: {
fooBar: () => `${foo} bar`
},
});
const val = ref("");
const myFooComputed = computed(() => useExampleStore().fooBar); However, with the latest version, I’m receiving the following warning:
This seems to suggest that there’s an issue with how computed properties are being handled in the latest version. I believe this is a significant issue that needs to be addressed. Any guidance or updates on this would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
-
I'm having the same issue |
Beta Was this translation helpful? Give feedback.
-
We have same issue using Options API for modifiable state I've already updated to Vue 3.4.19 and Pinia 2.1.7 - but still same issue. Usage in Component: computed: {
...mapWritableState(useTemporaryStore, ["currentObject"]),
}, Store: import { defineStore } from "pinia";
export const useTemporaryStore = defineStore("TemporaryStore", {
state: () => {
return {
currentObject: null,
};
},
}); |
Beta Was this translation helpful? Give feedback.
-
I am getting this warning when getter is accessing another getter from a different store: https://pinia.vuejs.org/core-concepts/getters.html#Accessing-other-stores-getters |
Beta Was this translation helpful? Give feedback.
-
I have the same issue using |
Beta Was this translation helpful? Give feedback.
In your case, it can work in this way.