HomePhabricator

[Cashtab] Patch improper useNavigate usage

Description

[Cashtab] Patch improper useNavigate usage

Summary:
T3463

Current implementation is from react router 6 migration.

the navigate() function returned from the useNavigate hook should not be called as part of the rendered component. In this case, we want to trigger it when the user sends or burns their whole token balance. So, call it in a useEffect block when this state change occurs.

Remove use from Etokens screen. Getting screens to render Onboarding if the user has no wallet should be done centrally from App.js in another diff (right now, Home and Receive do it, but other screens do not).

Test Plan:
npm test

Unfortunately cannot automate this integration test as would require chronik-client to change API calls in the future and respond to websocket msgs or a bridged jest-to-regtest instance (not yet set up). To test manually

  1. Send or burn all of a token
  2. Confirm you are navigated back to home screen
  3. Confirm no error in dev console

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

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

Details

Provenance
bytesofmanAuthored on Mar 15 2024, 21:12
bytesofmanPushed on Mar 18 2024, 16:11
Reviewer
Restricted Project
Differential Revision
D15710: [Cashtab] Patch improper useNavigate usage
Parents
rABC6abd8113c18c: Move {Load,Dump}Mempool to kernel namespace
Branches
Unknown
Tags
Unknown