fix: a balance refresh that returns after a network switch writes nothing (closes #577)
check / check (push) Canceled after 0s
e2e / e2e-chrome (push) Canceled after 0s
e2e / e2e-firefox (push) Canceled after 0s

The popup's doRefreshAndRender() and the background's backgroundRefresh()
each note the network a refresh starts on, and write its balances only if
that network is still the active one when the requests return. Otherwise
nothing is written, lastBalanceRefresh stays as the switch left it, and the
next refresh runs on the new network. The background checks inside
updateState(), against the record it is about to write. The popup refreshes
a copy of its wallets and copies the results onto its address records, by
address, after the check, because refreshBalances() writes into the records
it is given as each request returns.

Model: opus-5-5
This commit is contained in:
2026-10-20 18:24:48 +00:00
parent 93c34e1a2a
commit 0375f83470
5 changed files with 170 additions and 5 deletions
+5 -2
View File
@@ -2080,8 +2080,11 @@ view would leave a wallet one click from deletion.
none, and the tokens tracked on that network, and sends `chainChanged`
with the new chain id to every open tab. A token is tracked only on the
network it was added on, because a contract address names a token on one
network only. Choosing the network already active changes nothing and
sends nothing
network only. Switching also clears every address's balances. A balance
refresh, by the popup or the background, that started before the switch
stores nothing when it returns, so the previous network's balances never
reach the new one; the next refresh fetches the new network's. Choosing
the network already active changes nothing and sends nothing
- Ethereum RPC: endpoint URL input + "Save" button (validated against
`eth_chainId` before being saved)
- Blockscout API: endpoint URL input + "Save" button (validated against