Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collision of different apps - add namespaces #39

Open
ivanjaros opened this issue Nov 27, 2024 · 0 comments
Open

Collision of different apps - add namespaces #39

ivanjaros opened this issue Nov 27, 2024 · 0 comments

Comments

@ivanjaros
Copy link

ivanjaros commented Nov 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant