This repository was archived by the owner on Feb 23, 2024. It is now read-only.
This repository was archived by the owner on Feb 23, 2024. It is now read-only.
Local Storage usage in Blocks doesn't react to changes in other windows. #11309
Open
Description
We use Local Storage somehow in Cart/Checkout/Mini Cart, mainly for mini cart totals, and nonces and other info, however, that local storage doesn't react to changes coming from other windows, meaning you can end up with a stale data in a window that wouldn't work and would cause your requests to fail or totals to not be updated.
Solution
- First, unify usage of local storage to the
useLocalStorageState
hook instead of individual calls here and there.
- Add event reaction for thestorage
event so that memory copies of storage data is updated if local storage is updated in another window.