ERR_STORE_NOT_PROVIDED with simple module
See original GitHub issueI have a simple module:
import { Module, VuexModule, Mutation, Action, MutationAction } from 'vuex-module-decorators'
import { User } from '../models'
@Module({namespaced: false, name: 'user'})
export default class UserModule extends VuexModule {
user: User | null = null
profile: Profile = {}
@Mutation
setUserM(user: User) {
this.user = user
}
@Action({rawError: true})
async setUser(user: User) {
this.context.commit('setUserM', user)
}
}
And I add it to my store non-dynamically:
const store = new Vuex.Store({
modules: {
UserModule
},
})
But I get an error trying to invoke the action:
index.js?6fc5:234 Uncaught (in promise) Error: ERR_STORE_NOT_PROVIDED: To use getModule(), either the module
should be decorated with store in decorator, i.e. @Module({store: store}) or
store should be passed when calling getModule(), i.e. getModule(MyModule, this.$store)
at value (index.js?6fc5:234)
at getModule (index.js?6fc5:20)
at Store.eval (index.js?6fc5:297)
at step (index.js?6fc5:107)
at Object.eval [as next] (index.js?6fc5:88)
at eval (index.js?6fc5:81)
at new Promise (<anonymous>)
at __awaiter (index.js?6fc5:77)
at Store.action (index.js?6fc5:289)
at Array.wrappedActionHandler (vuex.esm.js?2f62:721)
I’m not calling getModule()
anywhere; it seems the action itself is calling getModule()
.
How to fix this?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:19 (1 by maintainers)
Top Results From Across the Web
Simple module - Wikipedia
Simple modules form building blocks for the modules of finite length, and they are analogous to the simple groups in group theory. In...
Read more >Simple module is isomorphic to $R/M$ where $M$ is a ...
A module is called simple if it is not the zero module and if it has no proper submodule. (a) Prove that any...
Read more >Brauer correspondent blocks with one simple module - arXiv
One of the main problems in representation theory is to understand the exact relationship between Brauer corresponding blocks of finite groups.
Read more >Simple module - Art of Problem Solving
A simple module over a ring $R$ is a module that is simple as a group with operators—that is, it is a module...
Read more >Irreducible Module -- from Wolfram MathWorld
A nonzero module M over a ring R whose only submodules are the module itself and the zero module. It is also called...
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 FreeTop 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
Top GitHub Comments
Had the same problem. I am not using dynamic modules. I fixed my issue by removing the
name
property in@Module({namespaced: false, name: 'user'})
Yeah dynamic is recommended
On Fri 19 Apr, 2019, 6:28 PM GaryO, notifications@github.com wrote: