robinvdvleuten / vuex-persistedstate

💾 Persist and rehydrate your Vuex state between page reloads.
https://npm.im/vuex-persistedstate
MIT License
5.76k stars 378 forks source link

Paths and Nested Stores #364

Closed chadwtaylor closed 3 years ago

chadwtaylor commented 3 years ago

First of all, fantastic plug-in!

Question: I have some nested stores in nuxt like so: /store/pages/person.js and I tried to use this but failed:

paths: ['pages/person']

When I moved the person.js into /store/person.js and used paths: ['person'] then that worked as expected. Am curious how one could use nested store in my first example above?

Thanks so much.


fabiofdsantos commented 3 years ago

Paths must be specified using dot notation. Try pages.person

theRiley commented 3 years ago

I had this same issue using Vuex modules. The dot notation in this reply worked perfectly. I didn't see dot notation used in the example docs for the Vuex modules.

Thanks for answering!

fabiofdsantos commented 3 years ago

@theRiley Np. It's here: https://github.com/robinvdvleuten/vuex-persistedstate#createpersistedstateoptions

theRiley commented 3 years ago

@fabiofdsantos awesome, i was looking at the example here: https://github.com/robinvdvleuten/vuex-persistedstate#example-with-vuex-modules

Thanks again this made my day so much easier! 😄

robinvdvleuten commented 3 years ago

@fabiofdsantos thank you for solving this problem!