This repository has been 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
Labels
block: mini-cart
Issues related to the Mini-Cart block.
team: Rubik
type: bug
The issue/PR concerns a confirmed bug.
type: technical debt
This issue/PR represents/solves the technical debt of the project.
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
useLocalStorageState
hook instead of individual calls here and there.- Add event reaction for the
storage
event so that memory copies of storage data is updated if local storage is updated in another window.The text was updated successfully, but these errors were encountered: