Skip to content

Warn if two stores are defined with the same name #1394

Open
@Soviut

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions