Closed nd0ut closed 8 years ago
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 SAVE
action 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:
// first we filter the state for this engine
import filter from 'redux-storage-decorator-filter'
engine = filter(engine, 'whitelisted-key');
// and now we add the telemetry decorator
import logEngineStatsDecorator from 'redux-storage-decorator-engine-logger';
engine = logEngineStatsDecorator(engine);
Would such a solution solve your needs?
I was playing with
redux-storage-decorator-filter
and noticed thatSAVE
action 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.