Date being SAVEd is not fully the same data being LOADed. #171
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MichaelContento/redux-storage#171
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Apologies if this is deemed a duplicate issue, but I felt my case was different enough from some of the other similar issues people were experiencing.
I have a strange issue. I am using redux-storage to store to the device in react-native. In attempting to save some data in a large ImmutableJS object, I can create a reducer and query for the data on action
REDUX_STORAGE_SAVEwhich looks like this:[ { id: 49, status: 'COMPLETE', status_set: '2016-10-20T16:37:51.516385Z' } ]The change to that data is the additions of the status_set property. After saving, if I continue to do things in the app, the state remains as reflected above.
If I then reload the application, it loads data from storage
storageEngine.load(store)I get:[ { id: 49, status: 'COMPLETE' } ]To further confuse, if I change the status in this example so on
REDUX_STORAGE_SAVEit looks like:[ { id: 49, status: 'INCOMPLETE', status_set: '2016-10-20T16:37:51.516385Z' }After loading I get:
[ { id: 49, status: 'INCOMPLETE' } ]So it is ok with updating a field, but not adding a new one? There are so many other places we add new fields, etc. and they all work.
I am using the following redux-storage libraries:
redux-storageredux-storage-decorator-debounceredux-storage-engine-reactnativeasyncstorageredux-storage-merger-immutablejsredux-storage-decorator-filterI use a bunch of white/black listing here, this particular state tree is entirely in the white list.redux-storage-decorator-migrateThere are not migrations yet it should be noted.Really stuck on this and could use any insight into how I can further debug the issue!
Sorry for the bad news but this package is no longer maintained. 😞
My focus has left the react / node ecosystem and I don't have to time to keep things up to date. But if you want to step in and become the new maintainer of
redux-storageand all of it parts, just ping me! 😃Re-opened as @guns2410 want's to work on this project: Give him a warm welcome 👏
Thanks @michaelcontento
@gijoehosaphat can you confirm what your redux state looks like when you perform these actions. redux-storage saves your exact redux state as is.
I can confirm that the when inspecting the data on the action 'REDUX_STORAGE_SAVE' the data looks correct.
When inspecting the data on a subsequent load, the data is incorrect.
In the example above we are adding a new field to the object called
status_set, that field seemingly gets dropped, however changes to the already existing fields are retained.This overall state object structure looks like this:
can you confirm that the reducer to update the state does not remove the key. May be you can post the reducer here and we can have a look.
Looks like I'm having the same issue. I believe we could fix this relatively easy by actually doing a
SAVEafterLOADon this line. That still heavily depends on the implementation (we have to make sure that we read useful data fromlocalStoragebefore we rewrite it with the app's initial state). Another solution I'd suggest is just notSAVEing until weLOAD.