fix: a save merges this page's tracked token change into the stored list (closes #717)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run

A save wrote `trackedTokens` whole, so two pages on one network dropped each
other's adds and brought back each other's removals.

A save that keeps the network now merges this page's change into the stored
list by contract address. A token both lists hold keeps this page's record.
Two pages that add one token can hold different records for it, and
`mergeListByIdentity()` alone would store both.

A save that switches networks is unchanged.

Model: opus-5-5
This commit is contained in:
2026-11-03 04:02:17 +00:00
parent 076726b13d
commit 798a1a36e7
3 changed files with 158 additions and 19 deletions
+10 -4
View File
@@ -397,10 +397,16 @@ is missing, a write fails.
The popup's `saveState()` (`src/shared/state.js`) reads the stored record,
merges this page's changes into it and writes it back. It writes only the fields
this page changed since its last save. Wallets, site lists and endpoints are
merged entry by entry, so two pages changing different things do not overwrite
each other. The background's `updateState()` reads the record, applies one
change and writes it back.
this page changed since its last save. It merges the fields below entry by
entry, so two pages changing different things do not overwrite each other:
- wallets;
- site lists;
- endpoints;
- tracked tokens.
The background's `updateState()` reads the record, applies one change and writes
it back.
Every write stamps `schemaVersion` with `STATE_SCHEMA_VERSION` from
`src/shared/stateSchema.js`, currently `1`. The version is raised only when the