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

Does vuex-pathify work with vuex-persist & vuex modules out of the box? #119

Closed
dimavolo opened this issue Dec 6, 2020 · 3 comments
Closed

Comments

@dimavolo
Copy link

dimavolo commented Dec 6, 2020

I've initialized vuex-persist in the standard way:

const vuexLocal = new VuexPersistence({
  storage: window.localStorage,
})

I have two typical vuex modules: [user, nav]

I'm finding that instead of persisting user.user.firstName, it is persisting it as user.firstName (i.e. one level up).

Does pathify normally work with vuex-persist and typical vuex modules out of the box, or is there some configuration required?

Thanks!

Update I found that if I change user.user to a unique sub-key name, like user.userData, then it all works as expected. Spoke too soon.

@davestewart
Copy link
Owner

Hey.

Should do, but this sounds like an issue with Vuex Persist rather than Pathify.

All Pathify does is the wiring to your store, along with some clever "reaching into" properties if you use make.mutations() and sub@properties.

If you remove Vuex Pathify does the other library magically work?

@davestewart
Copy link
Owner

Closing because no reply.

@vesper8
Copy link

vesper8 commented Apr 2, 2023

I found some really weird and abnormal behaviour when using vuex-pathify with vuex-persistedstate.

For example if I push something into an array like this this.myPathifyKey.push(someElement) then it will be registered (persisted) by vuex-persistedstate only if it's done in some places, such as in a mounted hook of a component, while if I do the exact same thing inside an event listener for example, then it will not be persisted.

But, if I do this instead this.$store.set('pathifyModule/myPathifyKey', ...myArray)

Then it will be persisted ? Go figure.. could not understand why it's failing in the first instance.

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

3 participants