Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Tracking down instigators of SAVE #100

Closed
guybenron opened this issue Feb 24, 2016 · 4 comments
Closed

Tracking down instigators of SAVE #100

guybenron opened this issue Feb 24, 2016 · 4 comments

Comments

@guybenron
Copy link

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_SAVE action 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

@michaelcontento
Copy link
Owner

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_SAVE should 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-debounce to delay the save operation 😉

Or is this the way you already tried to tackle it with no success?

@guybenron
Copy link
Author

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_TRIGGERED and EFFECT_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?

@michaelcontento
Copy link
Owner

@guybenron Would it be possible for you to checkout and use PR #102? This adds meta.origin to the action dispatched by redux-storage (only if NODE_ENV !== 'production').

@guybenron
Copy link
Author

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 !!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants