Skip to content
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
@senadir

Description

@senadir

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 the storage event so that memory copies of storage data is updated if local storage is updated in another window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    block: mini-cartIssues related to the Mini-Cart block.team: Rubiktype: bugThe issue/PR concerns a confirmed bug.type: technical debtThis issue/PR represents/solves the technical debt of the project.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions