vuex-persistedstate version: 4.1.0
node version: 14.15.4
npm (or yarn) version: 6.14.10
Relevant code or config:
export const state = () => ({
colorScheme: {
base: {"bg-color-primary": true},
light: {"bg-color-primary-light": true},
dark: {"bg-color-primary-dark": true}
}
})
export const mutations = {
changeColor(state, colorName) {
state.colorScheme.base = {"bg-color-orange": true};
state.colorScheme.light = {"bg-color-orange-light": true};
state.colorScheme.dark = {"bg-color-orange-dark": true}
}
}
What you did:
- Install package and use default plugin from readme (Example with Nuxt.js)
- Called mutation
- Reloaded browser
What happened:
- Localstorage restored after window reload, BUT, it has following states:
{
"base": {
"bg-color-primary": true,
"bg-color-orange": true
},
"light": {
"bg-color-primary-light": true,
"bg-color-orange-light": true
},
"dark": {
"bg-color-primary-dark": true,
"bg-color-orange-dark": true
}
}
// Following data was in localstorage before reload
{
"base": {
"bg-color-orange": true
},
"light": {
"bg-color-orange-light": true
},
"dark": {
"bg-color-orange-dark": true
}
}
Problem description:
- Store being restored, but it has merged default objects in store with restored ones.
vuex-persistedstateversion: 4.1.0nodeversion: 14.15.4npm(oryarn) version: 6.14.10Relevant code or config:
What you did:
What happened:
{ "base": { "bg-color-primary": true, "bg-color-orange": true }, "light": { "bg-color-primary-light": true, "bg-color-orange-light": true }, "dark": { "bg-color-primary-dark": true, "bg-color-orange-dark": true } }Problem description: