You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two Vue applications - front-end and back-end. I have noticed bugs on occasion where i have an empty array in my pinia config store and it will turn into undefined. I could not figure it out and it just fixed itself over time somehow. But i have finally found the problem. The backend and frontend are colliding with pinia shared state sync. Simply put, i have a "config" pinia store on frontend that has a "foo" field but the backend does not have this field - but it also has "config" pinia store. So when i open frontend, with backend being already open in another tab, this field will be set to undefined and my frontend blows up.
So I propose addition of "namespace" into the configuration when invoking pinia.use(PiniaSharedState({})) which should mitigate this problem.
PS: it seems this can be mitigated by using different names when you define your stores: export const cacheStore = defineStore('foo.cache', {}) vs export const cacheStore = defineStore('bar.cache', {})
But this should not be required and PSS should be able to handles this by itself - either using some auto-generated namespace or having an inif option, like i have mentioned.
The text was updated successfully, but these errors were encountered:
I have two Vue applications - front-end and back-end. I have noticed bugs on occasion where i have an empty array in my pinia config store and it will turn into undefined. I could not figure it out and it just fixed itself over time somehow. But i have finally found the problem. The backend and frontend are colliding with pinia shared state sync. Simply put, i have a "config" pinia store on frontend that has a "foo" field but the backend does not have this field - but it also has "config" pinia store. So when i open frontend, with backend being already open in another tab, this field will be set to undefined and my frontend blows up.
So I propose addition of "namespace" into the configuration when invoking
pinia.use(PiniaSharedState({}))
which should mitigate this problem.PS: it seems this can be mitigated by using different names when you define your stores:
export const cacheStore = defineStore('foo.cache', {})
vsexport const cacheStore = defineStore('bar.cache', {})
But this should not be required and PSS should be able to handles this by itself - either using some auto-generated namespace or having an inif option, like i have mentioned.
The text was updated successfully, but these errors were encountered: