fix: a network switch in Settings leaves no balance from the previous network stored (closes #653)
A save writes only the fields that differ from what the page last saved. When the page had last saved a balance of "0", the switch's cleared "0" was no change. So a balance that the background or another page stored since then stayed under the new network. The switch's save now also resets these fields in the stored record it reads: - every address's balance and token balances; - the time of the last balance refresh. Every other field merges as before. Model: opus-5-5
This commit is contained in:
+4
-2
@@ -591,8 +591,10 @@ function reportSaveFailure(err) {
|
||||
//
|
||||
// `beforeWrite`, when given, is called inside the lock with the stored record
|
||||
// as just read, before this page's state is compared against it. It may change
|
||||
// `state`, and this save writes that change. When it returns false, nothing is
|
||||
// written; any other return lets the save go ahead.
|
||||
// `state`, and this save writes that change. It may also change the stored
|
||||
// record. A field that this page did not change is then written as
|
||||
// `beforeWrite` left it. When it returns false, nothing is written; any other
|
||||
// return lets the save go ahead.
|
||||
function saveState(beforeWrite) {
|
||||
const turn = withLock("autistmask", () => saveStateOnce(beforeWrite));
|
||||
// Every failed save is reported, whether or not the caller awaited this
|
||||
|
||||
Reference in New Issue
Block a user