fix: the ETH line reads unknown at an address no refresh has read (closes #736)
An address's ETH balance is now null until a refresh has read it. That covers a new address, a new wallet, addresses a wallet scan finds, and every address after a network switch. Its line reads `quantity unknown`, Home's balance `unknown (ETH)`, and Send `Current balance: unknown (ETH)`. Max says the balance is unknown. Send is no longer refused as zero. The address has no total, and DeleteAddress warns that it may hold a balance. A refresh also deletes `balanceNotFetched` only when it read every address in the stored record. Model: opus-5-5
This commit was merged in pull request #741.
This commit is contained in:
+10
-7
@@ -99,12 +99,12 @@ let refreshTimer = null;
|
||||
//
|
||||
// The save also deletes `balanceNotFetched` from each tracked token whose
|
||||
// balance this refresh read at every address. A refresh that did not read every
|
||||
// address this page now holds deletes no `balanceNotFetched`. Adding a token
|
||||
// sets that field (trackToken() in src/popup/views/helpers.js). So does adding
|
||||
// an address, and so does a network switch. The save takes the field off the
|
||||
// matching tokens of the stored record (clearBalanceNotFetched() in
|
||||
// src/shared/state.js). The rest of the stored tracked token list stays as it
|
||||
// is.
|
||||
// address this page now holds, and every address in the stored record, deletes
|
||||
// no `balanceNotFetched`. Adding a token sets that field (trackToken() in
|
||||
// src/popup/views/helpers.js). So does adding an address, and so does a network
|
||||
// switch. The save takes the field off the matching tokens of the stored record
|
||||
// (clearBalanceNotFetched() in src/shared/state.js). The rest of the stored
|
||||
// tracked token list stays as it is.
|
||||
//
|
||||
// Once the save is done, the wallet list is drawn again. So are the balances
|
||||
// on AddressDetail or AddressToken when that screen is up. No other screen is
|
||||
@@ -151,7 +151,10 @@ async function doRefreshAndRender() {
|
||||
if (!stored.useBlockscout) {
|
||||
dropUntrackedTokens(state.wallets, stored.trackedTokens);
|
||||
}
|
||||
const readEveryAddress = state.wallets.every((wallet) =>
|
||||
const readEveryAddress = [
|
||||
...state.wallets,
|
||||
...stored.wallets,
|
||||
].every((wallet) =>
|
||||
wallet.addresses.every((addr) => refreshed.has(addr.address)),
|
||||
);
|
||||
if (readEveryAddress) clearBalanceNotFetched(stored, readTokens);
|
||||
|
||||
Reference in New Issue
Block a user