-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Warn if two stores are defined with the same name #1394
Comments
I had a simlar issue, where I had created a state variable and a function with the same name. I was getting some 'computed' error on my nuxt project until I did some digging |
Since Vuex there is one thing in my mind that could resolve the issue with possible name duplicates. Personally I have one big enum for a whole project (with store names) but it feels like a workaround. Maybe instead of using |
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 asundefined
.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
store/templates.ts
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.
The text was updated successfully, but these errors were encountered: