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

Unable to access data from Vuex after rehydration in Nuxt.js #247

Open
vishytk opened this issue Dec 15, 2021 · 4 comments
Open

Unable to access data from Vuex after rehydration in Nuxt.js #247

vishytk opened this issue Dec 15, 2021 · 4 comments

Comments

@vishytk
Copy link

vishytk commented Dec 15, 2021

Setup:

nuxt 2.15.7:
vuex-persistedstate 4.1.0:
node 16.13.1:
yarn 1.22.15:

plugins/persistedstate.js

import VuexPersistence from 'vuex-persist'

export default ({ store }) => {
  new VuexPersistence({
    key: 'applocal',
    storage: window.localStorage,
    restoreState: (key, storage) => JSON.parse(storage.getItem(key)),
  }).plugin(store)
}

When I reload the page data is restored from localStore to Vuex. But I am unable to access the data from the page. I have tried accessing the data from Nuxt lifehooks.

I have tried this both in ssr and spa modes and the result is the same.

@vishytk
Copy link
Author

vishytk commented Dec 18, 2021

Anyone ? please help.

@championswimmer
Copy link
Owner

Possible to share a small repro repository ?

@vishytk
Copy link
Author

vishytk commented Dec 20, 2021

Thanks for the response.

Due to solution architecture, it would be difficult to share functioning code.

I could provide remote access using teamviewer or anydesk if its okay.

@vishytk
Copy link
Author

vishytk commented Dec 20, 2021

BTW, I have found that the page component pages/{role}/index.vue is not loaded at at when the page is refreshed.

Vuex state after page refresh:
devtools-vuex

Components status after page refresh:
devtools-components

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

No branches or pull requests

2 participants