After a switch, trackedTokens and that network's list in networkTrackedTokens were one array. So a page's next add or removal also changed networkTrackedTokens, and the save wrote that page's older copy over the stored one. Another page's add on the previous network was lost, and its removal was undone.
applyChainSwitchFields() now gives trackedTokens a copy of the incoming network's list. An add or removal on the active network changes only trackedTokens.
The active network's entry in networkTrackedTokens now stays as it was at the switch until the page switches away. Nothing reads that entry for the active network: tokenSourcesByChainId() uses trackedTokens there, and the next switch overwrites the entry.
The two new tests follow the issue's example. The other page's save is a direct write to the stored record, as in the neighbouring tests.
After a switch, `trackedTokens` and that network's list in `networkTrackedTokens` were one array. So a page's next add or removal also changed `networkTrackedTokens`, and the save wrote that page's older copy over the stored one. Another page's add on the previous network was lost, and its removal was undone.
`applyChainSwitchFields()` now gives `trackedTokens` a copy of the incoming network's list. An add or removal on the active network changes only `trackedTokens`.
The active network's entry in `networkTrackedTokens` now stays as it was at the switch until the page switches away. Nothing reads that entry for the active network: `tokenSourcesByChainId()` uses `trackedTokens` there, and the next switch overwrites the entry.
The two new tests follow the issue's example. The other page's save is a direct write to the stored record, as in the neighbouring tests.
Closes https://git.eeqj.de/sneak/AutistMask/issues/719
Model: opus-5-5
After a switch, `trackedTokens` and that network's list in
`networkTrackedTokens` were one array. So a page's next add or removal also
changed `networkTrackedTokens`, and the save wrote that page's older copy over
the stored one. Another page's add on the previous network was lost, and its
removal was undone.
`applyChainSwitchFields()` now copies the incoming network's list. An add or
removal on the active network changes only `trackedTokens`.
Model: opus-5-5
PASS: a chain switch now gives trackedTokens its own copy of the incoming network's list, as #719 asks.
Follow-up note: no test covers this page's own removal on Sepolia after a switch (state.trackedTokens.splice() in src/popup/views/settings.js). Acceptable is a test shaped like the two new ones that removes TST instead of adding a token, and asserts that networkTrackedTokens.mainnet keeps what the other page stored and that TST stays gone after a switch to Ethereum Mainnet and back.
Judgement call: I read "the removal in the example" in the definition of done as the other page's removal, which the second new test covers.
Not run: the browser end-to-end suites (make test-e2e, make test-e2e-firefox).
Model: opus-5-5
PASS: a chain switch now gives `trackedTokens` its own copy of the incoming network's list, as https://git.eeqj.de/sneak/AutistMask/issues/719 asks.
Follow-up note: no test covers this page's own removal on Sepolia after a switch (`state.trackedTokens.splice()` in `src/popup/views/settings.js`). Acceptable is a test shaped like the two new ones that removes TST instead of adding a token, and asserts that `networkTrackedTokens.mainnet` keeps what the other page stored and that TST stays gone after a switch to Ethereum Mainnet and back.
Judgement call: I read "the removal in the example" in the definition of done as the other page's removal, which the second new test covers.
Not run: the browser end-to-end suites (`make test-e2e`, `make test-e2e-firefox`).
Model: opus-5-5
clawbot
merged commit ba61bedaaf into next2026-11-03 07:10:34 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
After a switch,
trackedTokensand that network's list innetworkTrackedTokenswere one array. So a page's next add or removal also changednetworkTrackedTokens, and the save wrote that page's older copy over the stored one. Another page's add on the previous network was lost, and its removal was undone.applyChainSwitchFields()now givestrackedTokensa copy of the incoming network's list. An add or removal on the active network changes onlytrackedTokens.The active network's entry in
networkTrackedTokensnow stays as it was at the switch until the page switches away. Nothing reads that entry for the active network:tokenSourcesByChainId()usestrackedTokensthere, and the next switch overwrites the entry.The two new tests follow the issue's example. The other page's save is a direct write to the stored record, as in the neighbouring tests.
Closes #719
Model: opus-5-5
PASS: a chain switch now gives
trackedTokensits own copy of the incoming network's list, as #719 asks.Follow-up note: no test covers this page's own removal on Sepolia after a switch (
state.trackedTokens.splice()insrc/popup/views/settings.js). Acceptable is a test shaped like the two new ones that removes TST instead of adding a token, and asserts thatnetworkTrackedTokens.mainnetkeeps what the other page stored and that TST stays gone after a switch to Ethereum Mainnet and back.Judgement call: I read "the removal in the example" in the definition of done as the other page's removal, which the second new test covers.
Not run: the browser end-to-end suites (
make test-e2e,make test-e2e-firefox).Model: opus-5-5