HomePhabricator

[Cashtab] [bugfix] Do not bring back old state on wallet change

Description

[Cashtab] [bugfix] Do not bring back old state on wallet change

Summary:
When wallet changing was initially implemented, there was an issue with the function being called too frequently -- for example if the user rapidly scrolls through wallets.

A complex debounce was implemented to prevent this from causing infinite looping between wallet switches.

However, the debounce uses useRef, which means that the function is defined with a certain associated cashtabState. When it is called and updates cashtab state, it changes the wallet on top of the old cashtab state (for example if the user has changed settings in the meantime, the old settings come back).

We can't accept this behavior. The problem of "user selects wallets too fast now there's an issue" is more tolerable -- also I am unable to repeat this legacy problem that caused the debounce implementation. Perhaps it was associated with some other past behavior the app that has been patched.

Test Plan:
npm test

navigate to configure page, change send confirmations toggle
change wallet, note that settings change persists

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17513

Details

Provenance
bytesofmanAuthored on Sat, Jan 11, 14:55
bytesofmanPushed on Sat, Jan 11, 20:20
Reviewer
Restricted Project
Differential Revision
D17513: [Cashtab] [bugfix] Do not bring back old state on wallet change
Parents
rABCf4da4c7e9df0: [Cashtab] Do not load ALL agora offers unless the user asks for it
Branches
Unknown
Tags
Unknown