Warn if two stores are defined with the same name
Author: SoviutCreated Jun 26, 2022Updated Sep 4, 2023
Labelsdiscussionfeature request
What problem is this solving
I have a store. I copied it to make a second store but forgot to change the name of the second store.
This resulted in very subtle bugs where store state that should never be able to be undefined was appearing as undefined.
It should be noted that these stores are being intentionally used in an un-strict manner where the state is being mutated directly.
store/invoices.ts
export const useStore = defineStore('invoices', () => {store/templates.ts
export const useStore = defineStore('invoices', () => {Proposed solution
Warn if multiple stores share the same name.
Describe alternatives you've considered
Using the Vue Dev Tools, I was able to see that only one store existed and it sometimes had the values of the first store and sometimes values from the second store.
Source: vuejs/pinia