Unable to use setMapStoreSuffix for mapStores in Options API in Nuxt #1097
-
ReproductionI'm not able to change the suffix used to map stores using the options API with Nuxt. Setting other suffixes renders the mapped store as undefined. Reproduction repo (just after loading the index, in console Steps to reproduce the behavior
Expected behaviorThe store should work instead of being undefined Actual behaviorThe store is undefined |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@posva Why was this converted to a discussion? Is this not a bug or am I missing something? How I can accomplish referencing my stores using mapStores by only using the id in Nuxt then? Thank you very much in advance! |
Beta Was this translation helpful? Give feedback.
-
You need to ensure the set store suffix function is called before your component gets mounted. In your case, you should directly import the useCartStore from ~/stores instead of ~/stores/cart |
Beta Was this translation helpful? Give feedback.
You need to ensure the set store suffix function is called before your component gets mounted. In your case, you should directly import the useCartStore from ~/stores instead of ~/stores/cart