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

How to use with vuex-persistedstate #269

Open
ozum opened this issue Dec 13, 2018 · 4 comments

Comments

@ozum
Copy link
Contributor

commented Dec 13, 2018

Hi,

I'm using vuex-persistedstate and vuex-orm with nuxt.

Also I have some vuex store data outside of vuex-orm created manually (not by database.register).

While vuex store data persisted between page refreshes, vuex-orm data is not. How can I do that?

Many thanks,

@ozum

This comment has been minimized.

Copy link
Contributor Author

commented Dec 13, 2018

I think I should asked the question in vuex-persistedstate repo, because it's only happening with data created in nuxtServerInit() and not seems to related to vuex-orm.

@ozum ozum closed this Dec 13, 2018

@ozum

This comment has been minimized.

Copy link
Contributor Author

commented Dec 13, 2018

I reopened case, because non vuex-orm data is persisted even it is created in nuxtServerInit()

nuxtServerInit({ commit }) {
  commit("SET_LOCALE", "xyz"); // This is persisted
  Option.create({ data: sample.options });  // This is not persisted.
}

Any suggestion?

@ozum ozum reopened this Dec 13, 2018

@kiaking

This comment has been minimized.

Copy link
Member

commented Dec 14, 2018

Oh, really...? I though nuxtServerInit would work since persisting data inside fetch works. Maybe it7s because vuex-orm is recreating the module state at client side...?

@ozum

This comment has been minimized.

Copy link
Contributor Author

commented Dec 14, 2018

vuex-persistedstate also overwrites data on client side. To be compatible with nuxt server side rendering, vuex-persistedstate is registered as a nuxt plugin instead of vuex plugin as described here. According to their doc it is related to ordering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.