robinvdvleuten / vuex-persistedstate

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

Local storage value not being set in Nuxt using the latest version of vuex-persistedstate 3.1.0 #369

Open ricardoaat opened 3 years ago

ricardoaat commented 3 years ago

Relevant code or config

import createPersistedState from 'vuex-persistedstate'

export default ({ store }) => {
  createPersistedState({
    key: 'lekey',
    paths: [],
    storage: {
      getItem: key => localStorage.getItem(key),
      setItem: (key, value) => localStorage.setItem(key, value),
      removeItem: key => localStorage.removeItem(key)
    }
  })(store)
}

What you did: Used the library with Nuxt with a very simple configuration that works on another of my projects.

What happened: When using the latest version the value in the local storage is always empty {} but when I downgrade to version ^2.7.1 it works perfectly. (The value in the local storage is populated with the store.

kicaal commented 3 years ago

You must include the names of the store modules in paths