Skip to content
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

Conflict with NuxtJS third-party modules #376

Open
Tcharlyson opened this issue Sep 10, 2021 · 2 comments
Open

Conflict with NuxtJS third-party modules #376

Tcharlyson opened this issue Sep 10, 2021 · 2 comments

Comments

@Tcharlyson
Copy link

Tcharlyson commented Sep 10, 2021

When using store-accessor from the doc in NuxtJS, @Action are working until other library is used as @nuxtjs/auth-next or @nuxtjs/i18n then error is :

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)

Few workarounds exist :

  1. Use @MutationAction instead of @Action seems to work BUT if no mutation is needed or a custom one is required, this is not a solution
  2. Disable vuex for all third-party modules vuex: false BUT we loose the main purpose of using third-party modules
  3. Import manually in all our components like public applicationModule = getModule(ApplicationModule, this.$store) BUT this is obviously time consuming

So how can we make @Action work and how do we explain that @MutationAction is working and not @Action ?

Big thanks !

@Tcharlyson
Copy link
Author

Tcharlyson commented Sep 10, 2021

When using store-accessor from the doc in NuxtJS, @Action are working until other library is used as @nuxtjs/auth-next or @nuxtjs/i18n then error is :

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)

Few workarounds exist :

  1. Use @MutationAction instead of @Action seems to work BUT if no mutation is needed or a custom one is required, this is not a solution
  2. Disable vuex for all third-party modules vuex: false BUT we loose the main purpose of using third-party modules
  3. Import manually in all our components like public applicationModule = getModule(ApplicationModule, this.$store) BUT this is obviously time consuming

So how can we make @Action work and how do we explain that @MutationAction is working and not @Action ?

Big thanks !

@Action is working until vuex-module-decorators:0.11.0

@VPetar
Copy link

VPetar commented Dec 14, 2021

@Tcharlyson well, you can mutate inside the function and return a custom object?
Anyways, thanks for figuring out at least @MutationAction works 0,o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants