fix: a save merges this page's tracked token change into the stored list (closes #717)
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 save that switches networks is unchanged. `mergeTrackedTokens()` does that merge, and the two other merges of tracked tokens now call it. It keeps one record per contract address, this page's for a token both lists hold, so a token held twice no longer multiplies. Model: opus-5-5
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user