question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

7reactions
danielroecommented, Apr 30, 2020

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.

0reactions
andrewvasilchukcommented, Apr 30, 2020

@danielroe, Thanks for the quick and comprehensive answer.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found