Improve error message for incorrect arguments in defineStore #855
Closed
bencodezen
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
I'm not completely sure we should have a warning for this because in the end, it's the type of errors you catch at the typing level. So, the question would be: how easy is it to miss? If it does happen often, then, we could add it as a dev only feature with the automatic id generation. WDYT? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
🧭 Context
So, I accidentally created a store without a storeId:
However, I got the following error in the console with things working kind of funny.
The solution ended up being a lack of an storeId, but the error doesn't really tell you this. In fact, I had no idea where to really start to debug it. However, luckily I realized the user error before reporting it as a bug. That said, I think we could improve this experience.
💡 Suggestion
If there is no store ID that's passed, then the error should throw an error that no ID was defined.
If a user forgets to pass an ID, maybe we automatically generate a store with a hash like
pinia-store-2398hf
? This way it doesn't crash the app, but still warns the developer that they should define one.Beta Was this translation helpful? Give feedback.
All reactions