fix: a second click on Add while the lookup waits tracks the token once (closes #727) #728

Merged
clawbot merged 1 commits from issue-727-recheck-tracked-after-lookup into next 2026-11-03 06:24:15 +01:00
Collaborator

The "already tracked" check on AddToken and SettingsAddToken ran only before the contract lookup. A second click on Add while the first lookup waited therefore tracked the token twice.

Both screens now check again when the lookup answers. An answer for a token tracked meanwhile shows that screen's "already tracked" flash message and tracks nothing. It also clears the status line. On AddToken, a lookup started before the screen was last opened leaves the status line alone, as its other answers do.

What the diff does not show:

  • The new check comes after the network check, because state.trackedTokens holds only the active network's tokens. An answer after a network switch still gets the network message.
  • On AddToken the first answer usually moves the screen to AddressDetail, so the second answer's flash message shows there.

Model: opus-5-5

The "already tracked" check on AddToken and SettingsAddToken ran only before the contract lookup. A second click on Add while the first lookup waited therefore tracked the token twice. Both screens now check again when the lookup answers. An answer for a token tracked meanwhile shows that screen's "already tracked" flash message and tracks nothing. It also clears the status line. On AddToken, a lookup started before the screen was last opened leaves the status line alone, as its other answers do. What the diff does not show: - The new check comes after the network check, because `state.trackedTokens` holds only the active network's tokens. An answer after a network switch still gets the network message. - On AddToken the first answer usually moves the screen to AddressDetail, so the second answer's flash message shows there. Model: opus-5-5
clawbot added the needs-review label 2026-11-03 05:49:55 +01:00
clawbot self-assigned this 2026-11-03 05:49:55 +01:00
clawbot added 1 commit 2026-11-03 05:49:55 +01:00
fix: a second click on Add while the lookup waits tracks the token once (closes #727)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
d58943cabe
The "already tracked" check ran only before the contract lookup, so a second click while the first lookup waited tracked the token twice. AddToken and SettingsAddToken now check again when the lookup answers. An answer for a token tracked meanwhile shows the "already tracked" flash message and tracks nothing.

Model: opus-5-5
Author
Collaborator

PASS: a second click on Add while the lookup waits now tracks the token once on both AddToken and SettingsAddToken, as #727 asks.

Follow-up notes, none of which fail this review:

  • tests/addTokenLateAnswer.test.js, test "a second click on Add while the lookup waits tracks the token once": since #717 a save drops duplicate tokens from the stored list, so its check of storage cannot see a second copy held in memory. Acceptable: also assert that state.trackedTokens equals [TOKEN], as the next test does.
  • src/popup/views/addToken.js and src/popup/views/settingsAddToken.js: no test fails if the new check moves above the network check. Acceptable: a test on each screen where the address is tracked on the network switched to, expecting the network-changed flash message.
  • src/popup/views/settingsAddToken.js, renderTop10(): a "Top tokens:" button has no already-tracked check and stays enabled until its save finishes, so a fast double click can track a token twice. Acceptable: an isTracked check at the top of that handler that shows "Already tracked."
  • tests/addTokenLateAnswer.test.js, header comment: "An answer while AddToken still shows goes to AddressDetail." An answer for a token already tracked stays on AddToken. Acceptable: "An answer that adds the token while AddToken still shows goes to AddressDetail."

Disclosures:

  • Judgement call: the header sentence above is not failed, because this PR only rewrapped it and its next sentence states the exception.
  • Unverified: the double click on a "Top tokens:" button comes from reading the code; it was not run in a browser.

Model: opus-5-5

PASS: a second click on Add while the lookup waits now tracks the token once on both AddToken and SettingsAddToken, as https://git.eeqj.de/sneak/AutistMask/issues/727 asks. Follow-up notes, none of which fail this review: - `tests/addTokenLateAnswer.test.js`, test "a second click on Add while the lookup waits tracks the token once": since https://git.eeqj.de/sneak/AutistMask/issues/717 a save drops duplicate tokens from the stored list, so its check of storage cannot see a second copy held in memory. Acceptable: also assert that `state.trackedTokens` equals `[TOKEN]`, as the next test does. - `src/popup/views/addToken.js` and `src/popup/views/settingsAddToken.js`: no test fails if the new check moves above the network check. Acceptable: a test on each screen where the address is tracked on the network switched to, expecting the network-changed flash message. - `src/popup/views/settingsAddToken.js`, `renderTop10()`: a "Top tokens:" button has no already-tracked check and stays enabled until its save finishes, so a fast double click can track a token twice. Acceptable: an `isTracked` check at the top of that handler that shows "Already tracked." - `tests/addTokenLateAnswer.test.js`, header comment: "An answer while AddToken still shows goes to AddressDetail." An answer for a token already tracked stays on AddToken. Acceptable: "An answer that adds the token while AddToken still shows goes to AddressDetail." Disclosures: - Judgement call: the header sentence above is not failed, because this PR only rewrapped it and its next sentence states the exception. - Unverified: the double click on a "Top tokens:" button comes from reading the code; it was not run in a browser. Model: opus-5-5
clawbot merged commit 267b69382e into next 2026-11-03 06:24:15 +01:00
clawbot deleted branch issue-727-recheck-tracked-after-lookup 2026-11-03 06:24:15 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#728