applyChainSwitchFields() in src/shared/chainSwitchFields.js, and the save in saveStateOnce() (src/shared/state.js).
What happens
Found by the review of #704, outside its scope; the same on next before that PR.
After a switch, trackedTokens and that network's list in networkTrackedTokens are one array. So when a page has switched to a network that already has a list, its next add or removal also changes networkTrackedTokens, and the save writes that page's older copy of networkTrackedTokens over the stored one.
Example: page A switches to Sepolia. Page B adds NEW before it takes that switch, and "Added NEW" shows. A then adds a token on Sepolia. NEW is now on neither network. A removal by B is undone the same way.
What should happen
No tracked token is lost and none comes back. A page's add or removal on the active network changes only trackedTokens.
Severity: minor
Definition of done
applyChainSwitchFields() gives trackedTokens its own copy of the incoming network's list.
A test for the add and a test for the removal in the example, each failing on next.
Model: opus-5-5
## Where
`applyChainSwitchFields()` in `src/shared/chainSwitchFields.js`, and the save in `saveStateOnce()` (`src/shared/state.js`).
## What happens
Found by the review of https://git.eeqj.de/sneak/AutistMask/pulls/704, outside its scope; the same on `next` before that PR.
After a switch, `trackedTokens` and that network's list in `networkTrackedTokens` are one array. So when a page has switched to a network that already has a list, its next add or removal also changes `networkTrackedTokens`, and the save writes that page's older copy of `networkTrackedTokens` over the stored one.
Example: page A switches to Sepolia. Page B adds NEW before it takes that switch, and "Added NEW" shows. A then adds a token on Sepolia. NEW is now on neither network. A removal by B is undone the same way.
## What should happen
No tracked token is lost and none comes back. A page's add or removal on the active network changes only `trackedTokens`.
Severity: minor
## Definition of done
- [ ] `applyChainSwitchFields()` gives `trackedTokens` its own copy of the incoming network's list.
- [ ] A test for the add and a test for the removal in the example, each failing on `next`.
Model: opus-5-5
clawbot
self-assigned this 2026-11-03 00:04:24 +01:00
Plan: one PR to next, after #717, which shares the test file. In applyChainSwitchFields() in src/shared/chainSwitchFields.js, s.trackedTokens becomes a structuredClone() of the incoming network's list, or an empty list. Tests as in the definition of done.
Model: opus-5-5
Plan: one PR to `next`, after https://git.eeqj.de/sneak/AutistMask/issues/717, which shares the test file. In `applyChainSwitchFields()` in `src/shared/chainSwitchFields.js`, `s.trackedTokens` becomes a `structuredClone()` of the incoming network's list, or an empty list. Tests as in the definition of done.
Model: opus-5-5
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.
Where
applyChainSwitchFields()insrc/shared/chainSwitchFields.js, and the save insaveStateOnce()(src/shared/state.js).What happens
Found by the review of #704, outside its scope; the same on
nextbefore that PR.After a switch,
trackedTokensand that network's list innetworkTrackedTokensare one array. So when a page has switched to a network that already has a list, its next add or removal also changesnetworkTrackedTokens, and the save writes that page's older copy ofnetworkTrackedTokensover the stored one.Example: page A switches to Sepolia. Page B adds NEW before it takes that switch, and "Added NEW" shows. A then adds a token on Sepolia. NEW is now on neither network. A removal by B is undone the same way.
What should happen
No tracked token is lost and none comes back. A page's add or removal on the active network changes only
trackedTokens.Severity: minor
Definition of done
applyChainSwitchFields()givestrackedTokensits own copy of the incoming network's list.next.Model: opus-5-5
Plan: one PR to
next, after #717, which shares the test file. InapplyChainSwitchFields()insrc/shared/chainSwitchFields.js,s.trackedTokensbecomes astructuredClone()of the incoming network's list, or an empty list. Tests as in the definition of done.Model: opus-5-5