-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
On 6.0.0 the rehydrated state is incomplete when the store schema changes. There is a PR to fix this (#114) however there is a scenario it doesn't cater for, and it was suggested that this scenario should be documented in a new issue.
Scenario
If a key has been removed from the store's initialState but still included in the saved state in local storage, the rehydrated state will include the deleted key. This is not ideal as it makes it impossible to remove keys from your store schema. This also applies to nested keys.
Example
Store initial state
{
"key1": {
"nestedKey1": "value",
"nestedKey2": "another value",
},
"key2": false
}Saved state in local storage
{
"key1": {
"nestedKey1": "update value",
"nestedKey2": "another value",
"nestedKey3": "deleted value"
},
"key3": true
}Expected rehydrated state
{
"key1": {
"nestedKey1": "updated value",
"nestedKey2": "another value",
},
"key2": false
}Actual rehydrated state (on #114)
{
"key1": {
"nestedKey1": "updated value",
"nestedKey2": "another value",
"nestedKey3": "deleted value"
},
"key2": false,
"key3": true
}If this issue is fixed, it would also be ideal to remove to redundant keys from local storage as well. However this might be complicated especially on nested keys.
Metadata
Metadata
Assignees
Labels
No labels