You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subscribing to all actions is causing multi-tab problem in local storage #29
Since local storage is shared between tabs it could happens that when a previous tab is focused it reverts data in local storage, saving an outdate payload.
Example:
I have api1 and api2 in the store. Only api1 is redux-remembered
open tab1 and both are fetched with api1=xapi2=y. api1=x is saved to local storage
open tab2, api1 is rehydrated and api2 is fetched
on tab2, api1 expires in the store, api1=z is fetched and saved to local storage
user focus on tab1 and trigger an action (for example api2 is fetched)
api1=x is saved to local storage -> ERROR
open tab3 and api1=x is rehydrated -> ERROR
Is it correct that a api1 is set in the local storage when api2 changes?
This problem happens also with slice, not only with api.
POSSIBLE SOLUTION:
api1 should be updated in the local storage only if there is an action related only to api1. Isn't it? Am I missing something?
consumers should implement a logic to keep local storage in sync across tabs
Hey @Luk-z, you need a way to manually rehydrate your state without persisting it.
Unfortunately this means a lot of possible invalid bug reports being opened because of how people will use this.
For now there is no such unsafe force-rehydrate API call, but there's already a PR suggesting one.
From what I've seen there's a need for such unsafe functionality, but I need to make sure it's marked explicitly unsafe.
Stay tuned - we'll definitely have such functionality in the next major release, I just need to find some time to figure out a cleaner way to do it.
Activity
Luk-z commentedon Sep 2, 2026
Another solution could be to hydrate also when localStorage change.
zewish commentedon Sep 8, 2026
Hey @Luk-z, you need a way to manually rehydrate your state without persisting it.
Unfortunately this means a lot of possible invalid bug reports being opened because of how people will use this.
For now there is no such unsafe force-rehydrate API call, but there's already a PR suggesting one.
From what I've seen there's a need for such unsafe functionality, but I need to make sure it's marked explicitly unsafe.
Stay tuned - we'll definitely have such functionality in the next major release, I just need to find some time to figure out a cleaner way to do it.