Tracking down instigators of SAVE #100
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MichaelContento/redux-storage#100
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?
Love this package! :)
I'm using redux-storage-decorator-filter to restrict the save calls to a specific part of the state. I also just started using redux-sagas, so I put the three
EFFECT_*actions into the storage blacklist, and they both work together beautifully.However, I'm getting an extra
REDUX_STORAGE_SAVEaction which I have no clue why it's being dispatched, and there is no information I can see to help me figure it out. How do I track down the part of the code that caused the save operation to happen ... ?Thanks !
-Guy
You're welcome! 😎
It should be pretty easy, as redux-storage simply dispatches a whole new action (or in other words: no special dispatching magic involved!). So the action right before
REDUX_STORAGE_SAVEshould be the action that has triggerd this save operation.NOTE: If your using redux-storage-decorator-debounce this relation is no longer valid, as it's the main job of
decorator-debounceto delay the save operation 😉Or is this the way you already tried to tackle it with no success?
Thanks for responding :)
I've tried to track it down like you said, but redux-sagas uses actions very liberally (almost every API call results in two actions) so it makes tracking down the source of the save very confusing. What I can say for sure after following a single flow, is that the save action is dispatched even if the filtered state doesn't change.
I'm also using redux-logger to log all of the actions, but just to make sure I listened in to the redux-sagas actions and JSON.stringified the state to the console. I'm seeing a bunch of
EFFECT_TRIGGEREDandEFFECT_RESOLVED, but the state does not change :(The only thing that comes to mind is that maybe the before state and after state, while identical, aren't the same object - immutability etc. But it's really grasping at straws for me at this point...
Any suggestions as to how to further break this down and hunt the errant code?
@guybenron Would it be possible for you to checkout and use PR #102? This adds
meta.originto the action dispatched byredux-storage(only ifNODE_ENV !== 'production').Looks like it's what I need, however something came up and I won't be able to check it out :(
If and when it becomes relevant again, will definitely look into it...
Again, thank you !!