fix: state objects don't work with submodules
See original GitHub issue🐛 The bug
I get the following issue during invocation of useAccessor
function.
const storePattern = {
state,
mutations,
modules: {
foo,
},
}
const store = new Vuex.Store(storePattern)
export const accessor = useAccessor(store, storePattern)
Uncaught TypeError: Cannot set property foo of #<Object> which has only a getter
🛠️ To reproduce
Try to invoke useAccessor
with any module, which state
declared as plain object.
🌈 Expected behaviour I expect the correct module registration.
ℹ️ Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Git will not init/sync/update new submodules - Stack Overflow
To fix, I had to delete the submodules/thing folder, commit the deletion, then run the git submodule add command to add it back...
Read more >Common Git problems (and solutions!) - gists · GitHub
Working with submodules in your repository ... Make sure the submodule is on the correct branch and not in a detached head. ......
Read more >Git - Submodules - Git SCM
To solve the problem, you need to figure out what state the submodule should be in. Strangely, Git doesn't really give you much...
Read more >Git Submodules: Adding, Using, Removing, Updating
Since I'm using submodules, the code can be pulled directly from the relevant submodule repositories rather than requiring me to manually update each...
Read more >Effectively Working with Git Submodules
This gives nicer debugger experience for developer without any hustle to enable symbols and be able to "step into" the package source code....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
typed-vuex
you’ll need to use a state function, which doesn’t suffer from this kind of mutation by Vuex. I’ll consider whether there is a simple way to enable state object usage.@danielroe, Thanks for the quick and comprehensive answer.