Why SAVE action dispatched with state not processed with engine? #135
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MichaelContento/redux-storage#135
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?
I was playing with
redux-storage-decorator-filterand noticed thatSAVEaction comes with untouched state. I supposed to catch the action with the filtered state.I imagine all this flow like that:

I mean I think the SAVE action should be dispatched with state processed with decorators.
But with the current architecture it's hard to catch state between decorators and engine. The easiest way is to catch it right from engine.
Also I think it would be great to customize a save dispatcher

I'll make PR soon
Sorry for the very very delayed response! 😞
Yes, the state passed with the
SAVEaction is the whole state tree and not the actual part that has been saved by the engine. This is by done design and there are argument for both ways (passing the whole state or only the final slice).If you want to track only the written slices (and, for example, other informations like the size in bytes or the duration) you can add a new decorator to the mix like:
Would such a solution solve your needs?