Right now I am facing the issue where I have to update multiple reducers one after other. This creates inconsistency in the local storage.
How inconsistency is happening:
Suppose we have multiple dispatches are lined up.
After 1st dispatch and state update, the data is stored in the local storage which triggers storage event.
Now this update triggers another storage event, which is okay if something didn't change on the tab which initiated the 1st dispatch and things work out properly.
But most of the times due to async nature of dispatch and storage events the data ends up in a bad shape.
I was thinking that if I would have a function that I would call to actually flush the data to the storage, so the event only triggers once with the complete set of updated data.
Or is there some better solution that already exists for this, maybe to batch the dispatches for state updates across multiple reducers and put the data at once in the local storage?
Right now I am facing the issue where I have to update multiple reducers one after other. This creates inconsistency in the local storage.
How inconsistency is happening:
storage
event.storage
event, which is okay if something didn't change on the tab which initiated the 1st dispatch and things work out properly.I was thinking that if I would have a function that I would call to actually flush the data to the storage, so the event only triggers once with the complete set of updated data.
Or is there some better solution that already exists for this, maybe to batch the dispatches for state updates across multiple reducers and put the data at once in the local storage?