fix: Home's list drops the previous network's rows after a network switch (closes #718) #738

Merged
clawbot merged 1 commits from issue-718-home-list-after-network-switch into next 2026-11-03 09:54:36 +01:00
Collaborator

Fixes #718.

A network switch left the previous network's rows or failure message in Home's list until the new network's answer landed. loadHomeTxs() now replaces them with "Loading..." when it starts on a network other than the one the list holds. A redraw on the same network keeps its rows, so the ten-second refresh does not blink.

Home, AddressDetail and AddressToken compared the page's network before reading storage. A switch made in Settings can change the page during that read, and the answer was still drawn. They now compare after the read, for an answer and for a failure.

What the diff does not show:

  • The list is emptied when Home is next drawn, not at the switch. Every way onto Home draws Home first.
  • When the popup takes a switch saved elsewhere while Home is showing, the old rows stay up for the length of that save's write, as the balances do.

Disclosures:

  • Judgement call: the plan says to compare the page's network again after the read. I moved the compare there instead of repeating it, because a compare before the read only skips that read.
  • Deviation: two tests are in tests/popupFollowsNetworkSwitch.test.js, not the plan's file, because only that file drives the real popup.
  • Unverified: not run in a browser.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/AutistMask/issues/718. A network switch left the previous network's rows or failure message in Home's list until the new network's answer landed. `loadHomeTxs()` now replaces them with "Loading..." when it starts on a network other than the one the list holds. A redraw on the same network keeps its rows, so the ten-second refresh does not blink. Home, AddressDetail and AddressToken compared the page's network before reading storage. A switch made in Settings can change the page during that read, and the answer was still drawn. They now compare after the read, for an answer and for a failure. What the diff does not show: - The list is emptied when Home is next drawn, not at the switch. Every way onto Home draws Home first. - When the popup takes a switch saved elsewhere while Home is showing, the old rows stay up for the length of that save's write, as the balances do. Disclosures: - Judgement call: the plan says to compare the page's network again after the read. I moved the compare there instead of repeating it, because a compare before the read only skips that read. - Deviation: two tests are in `tests/popupFollowsNetworkSwitch.test.js`, not the plan's file, because only that file drives the real popup. - Unverified: not run in a browser. Model: opus-5-5
clawbot added the needs-review label 2026-11-03 09:04:09 +01:00
clawbot self-assigned this 2026-11-03 09:04:09 +01:00
Author
Collaborator

FAIL: needs rework. One defect: Home can still show the previous network's rows or failure message after a network switch, which #718 rules out.

src/popup/views/home.js, loadHomeTxs(): listNetworkId can name a network the list does not hold.

It is set when a load starts, not when an answer or failure message is written to the list. An older request can therefore fill the list while listNetworkId names another network. The next draw on that network then keeps what it finds.

A user meets this with a slow Blockscout answer:

  1. Home on Ethereum Mainnet is waiting for an answer.
  2. Pick Sepolia in Settings and go Back to Home.
  3. Open Settings and pick Ethereum Mainnet. The old request lands now and writes Mainnet's rows or failure message to the list.
  4. Pick Sepolia and go Back to Home.

Home on Sepolia then shows Mainnet's rows or failure message, not "Loading...", until Sepolia's answer lands. The comment above let listNetworkId ("The network that home-tx-list holds rows or a message for") is false in this case.

Acceptable:

  • Add listNetworkId = networkId; immediately before renderHomeTxList(ctx); in the answer path, and immediately before the "Failed to load transactions." write in the failure path.
  • Add a Jest test under "Home's list" in tests/historyAfterNetworkSwitch.test.js, one case for rows and one for the failure message:
    • hold the first Mainnet request and call HOME.open();
    • call onChainSwitch("sepolia"), hold a request and call HOME.open();
    • call onChainSwitch("mainnet") and let the first request land or fail;
    • call onChainSwitch("sepolia"), hold a request and call HOME.open();
    • expect "Loading..." in the list, and neither tx-row nor "Failed to load transactions."

Unverified: this was not run in a browser.

Model: opus-5-5

**FAIL: needs rework.** One defect: Home can still show the previous network's rows or failure message after a network switch, which https://git.eeqj.de/sneak/AutistMask/issues/718 rules out. **`src/popup/views/home.js`, `loadHomeTxs()`: `listNetworkId` can name a network the list does not hold.** It is set when a load starts, not when an answer or failure message is written to the list. An older request can therefore fill the list while `listNetworkId` names another network. The next draw on that network then keeps what it finds. A user meets this with a slow Blockscout answer: 1. Home on Ethereum Mainnet is waiting for an answer. 2. Pick Sepolia in Settings and go Back to Home. 3. Open Settings and pick Ethereum Mainnet. The old request lands now and writes Mainnet's rows or failure message to the list. 4. Pick Sepolia and go Back to Home. Home on Sepolia then shows Mainnet's rows or failure message, not "Loading...", until Sepolia's answer lands. The comment above `let listNetworkId` ("The network that `home-tx-list` holds rows or a message for") is false in this case. Acceptable: - Add `listNetworkId = networkId;` immediately before `renderHomeTxList(ctx);` in the answer path, and immediately before the "Failed to load transactions." write in the failure path. - Add a Jest test under "Home's list" in `tests/historyAfterNetworkSwitch.test.js`, one case for rows and one for the failure message: - hold the first Mainnet request and call `HOME.open()`; - call `onChainSwitch("sepolia")`, hold a request and call `HOME.open()`; - call `onChainSwitch("mainnet")` and let the first request land or fail; - call `onChainSwitch("sepolia")`, hold a request and call `HOME.open()`; - expect "Loading..." in the list, and neither `tx-row` nor "Failed to load transactions." Unverified: this was not run in a browser. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-11-03 09:24:25 +01:00
clawbot added 1 commit 2026-11-03 09:37:57 +01:00
fix: Home's list drops the previous network's rows after a network switch (closes #718)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
e44d9b3cd8
A network switch left the previous network's rows or failure message in Home's
list until the new network's answer landed. Home now replaces them with
"Loading..." when it first draws on a new network. A redraw on the same network
keeps its rows.

Home, AddressDetail and AddressToken compared the page's network before reading
storage. A switch made in Settings could change the page during that read, and
the answer was still drawn. They now compare after the read, for an answer and
for a failure.

Model: opus-5-5
clawbot force-pushed issue-718-home-list-after-network-switch from dd091a6e1d to e44d9b3cd8 2026-11-03 09:37:57 +01:00 Compare
Author
Collaborator
  • src/popup/views/home.js: loadHomeTxs() sets listNetworkId immediately before renderHomeTxList(ctx); and before the "Failed to load transactions." write.
  • tests/historyAfterNetworkSwitch.test.js: added the test under "Home's list", one case for rows and one for the failure message.

Model: opus-5-5

- `src/popup/views/home.js`: `loadHomeTxs()` sets `listNetworkId` immediately before `renderHomeTxList(ctx);` and before the "Failed to load transactions." write. - `tests/historyAfterNetworkSwitch.test.js`: added the test under "Home's list", one case for rows and one for the failure message. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-11-03 09:38:04 +01:00
Author
Collaborator

PASS: the first review's finding is fixed as it says, and #738 meets the definition of done of #718.

Unverified: not run in a browser.

Model: opus-5-5

PASS: the first review's finding is fixed as it says, and https://git.eeqj.de/sneak/AutistMask/pulls/738 meets the definition of done of https://git.eeqj.de/sneak/AutistMask/issues/718. Unverified: not run in a browser. Model: opus-5-5
clawbot merged commit 49713e1cdb into next 2026-11-03 09:54:36 +01:00
clawbot deleted branch issue-718-home-list-after-network-switch 2026-11-03 09:54:36 +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#738