-
-
Notifications
You must be signed in to change notification settings - Fork 27
fix: state objects don't work with submodules #100
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
Comments
@andrewvasilchuk Fancy a repro? 🤞 I'm looking at the test code here, for example, and not seeing any issue with |
@danielroe, Getting this issue when |
@andrewvasilchuk Is this an error from TypeScript or a bug in the behaviour of the accessor? (I'm reading your report as the former.) I also take it that you are not using Nuxt? |
@danielroe, It's a runtime bug. I am not using Nuxt.js, so state is not a function. |
Thanks. It's definitely bad behaviour. Though I recommend a function, the accessor should definitely support a simple object. Will investigate. |
@danielroe, Yes, a function solved the issue. |
If you have submodules defined, Vuex actually mutates the state object passed in - so that when the accessor is created, it gets a state object that is different from the one passed to Vuex. For the moment, that means if you want to use |
@danielroe, Thanks for the quick and comprehensive answer. |
🐛 The bug
I get the following issue during invocation of
useAccessor
function.🛠️ To reproduce
Try to invoke
useAccessor
with any module, whichstate
declared as plain object.🌈 Expected behaviour
I expect the correct module registration.
ℹ️ Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: