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.

ERR_STORE_NOT_PROVIDED with simple module

See original GitHub issue

I 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:open
  • Created 4 years ago
  • Reactions:14
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

87reactions
fgarit-tecommented, Mar 30, 2020

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'})

23reactions
championswimmercommented, Apr 20, 2019

Yeah dynamic is recommended

On Fri 19 Apr, 2019, 6:28 PM GaryO, notifications@github.com wrote:

I ended up just using dynamic registration and the problem went away.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/championswimmer/vuex-module-decorators/issues/116#issuecomment-484888021, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKD7STY3UNPG4XVNXIVBR3PRG6XRANCNFSM4HGVXGNA .

Read more comments on GitHub >

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

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