Support store structure changing
See original GitHub issueFor example, we have a user vuex-module with this state:
{
token: '',
name: '',
}
The state is saved in local storage.
createMultiTabState({ statesPaths: ['user'] })
{ "token": "tokenstring", "name": "Jonn Smith" }
But some reasons we change state object to:
{
name: '',
auth: {
token: ''
},
}
And now want to keep in storage only user.auth
path.
createMultiTabState({ statesPaths: ['use.auth'] })
Reload page - and it removes the state auth
key! The app is broken.
client.js?06a0:97 TypeError: Cannot read property 'token' of undefined
This error happens in the getter:
{
isAuthenticated(state) {
return !!state.auth.token;
},
}
And yes, I can fix it:
{
isAuthenticated(state) {
return !!state.auth && !!state.auth.token;
},
}
But maybe It will be better if vuex-multi-tab-state will respect the default state and do not override it if the path does not exist in the local storage. And do not create top-level state properties if they were removed from the default state. What do you think?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Structure Changes that Drive Change - Prosci
Structural changes associated with improvement systems - like adopting a new operational methodology - are changes where change management is often ignored.
Read more >How To Successfully Change Your Organizational Structure
1. Understanding Your Current Problems And Goals. When planning changes, you must fully understand your current problems and your intended ...
Read more >Organizational Structure and Culture Change
For example, a supervisor went from managing five or more stores in 1988 to 20 or more stores in 1991. Managers also focused...
Read more >Six Steps to Effective Organizational Change Management
Providing a support structure is essential to assist employees to emotionally and practically adjust to the change and to build proficiency of behaviors...
Read more >Set Up a Store Pages Structure on Facebook
To set up stores on Facebook: Open Store Locations in Business Manager. Select the Page in the top menu for which you want...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Random: I can imagine that for some cases it’d be actually better to store the whole store behind a version. Then by initialization you’d be able to migrate existing data.
@andrey-hohlov What I did to get around this at least for the people using the application was on login
window.localStorage.removeItem('vuex-multi-tab')
For myself while developing on localhost I just had to manually clear it