Skip to content

LocalStorageWrapper has racing condtion #204

@stanleyyconsensys

Description

@stanleyyconsensys

Description:
when connecting a wallet, it will set the wallet id into Storage,
when setting a item in Storage, it will generate a UUID as key and delete the previous item with the previous key

however, if we try to get the storage in async way, e.g put getLastConnectedWallet in reactjs useEffect

the behaviour will become a racing condition, new item may appended to the storage
image

it could result when getting last wallet id incorrect

resolution:
may try to use https://www.npmjs.com/package/async-mutex to create lock

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions