fix: the address screen shows a token just added at its fetched balance, not 0.0000 (closes #516)
A balance refresh that returns now draws the balances on AddressDetail or AddressToken again when that screen is up, not only the wallet list; their transaction lists are left alone. Every add path on AddToken and SettingsAddToken tracks a token through one step, trackToken(), which also lists it in the new stored field tokensNotFetched: its line reads `quantity unknown` instead of 0.0000 until a refresh that started with it tracked has fetched every address's token balances, even if the popup closes first. To tell an address whose token balances the explorer did not return, the refresh takes them off its copy of the wallets before fetching. Model: opus-5-5
This commit is contained in:
@@ -1396,7 +1396,9 @@ lists, the send-screen token selector, the address total and the remove-address
|
||||
warning (`isBelowOneMillionth()` in `src/shared/amountDisplay.js`). The Send and
|
||||
confirmation screens show it when its token is the one being sent. Tracked
|
||||
tokens with a zero balance are listed as well while "Show tracked tokens with
|
||||
zero balance" is on.
|
||||
zero balance" is on; a token just added on AddToken or SettingsAddToken whose
|
||||
balance no refresh has fetched yet is listed there as `quantity unknown` (see
|
||||
AddToken).
|
||||
|
||||
#### Stored state and its version
|
||||
|
||||
@@ -1567,6 +1569,13 @@ such as an edit typed into Settings and not yet saved. Home is the one screen
|
||||
"Back" always re-renders, so the wallet list reflects anything that changed
|
||||
while the user was away from it.
|
||||
|
||||
The popup refreshes balances every ten seconds while it is open
|
||||
(`doRefreshAndRender()` in `src/popup/index.js`). Each refresh that returns
|
||||
draws the wallet list again and, when AddressDetail or AddressToken is up, that
|
||||
screen's USD total and balance lines; its transaction list is left alone. No
|
||||
other screen is drawn again by a refresh, DeleteAddress and its balance lines
|
||||
included.
|
||||
|
||||
A network switch leaves every screen on the page showing the previous network.
|
||||
The user makes it in Settings, or approves a site's request and the background
|
||||
saves it. Any other popup open meanwhile takes the switch from the stored
|
||||
@@ -2078,7 +2087,14 @@ view would leave a wallet one click from deletion.
|
||||
- "Add" button
|
||||
- **Transitions**:
|
||||
- "Add" (valid contract) → tracks the token, pops the stack, and re-renders
|
||||
**AddressDetail**
|
||||
**AddressDetail**. The token's balance is not known until a balance
|
||||
refresh that started with it tracked has fetched every address's token
|
||||
balances; until then its balance line reads `quantity unknown`, never
|
||||
`0.0000`, unless the explorer had already listed a holding of it. That
|
||||
holds after the popup is closed and opened again, as the tokens still
|
||||
waiting for a fetch are stored with the profile. A refresh that returns
|
||||
draws AddressDetail's balances again (see Navigation), so the fetched
|
||||
balance shows without the screen being reopened
|
||||
- "Add" with a token already tracked, a scam-listed address, or a failed
|
||||
contract lookup → flash message, no screen change
|
||||
- "Add", then a network switch in Settings before the contract lookup
|
||||
@@ -2355,7 +2371,9 @@ view would leave a wallet one click from deletion.
|
||||
add path
|
||||
- **Transitions**:
|
||||
- Any of the add paths shown, on success → adds the token and shows an
|
||||
"Added SYMBOL" flash message (no screen change)
|
||||
"Added SYMBOL" flash message (no screen change). Until its balance is
|
||||
fetched, its balance line reads `quantity unknown`, as after "Add" on
|
||||
AddToken
|
||||
- A duplicate, a scam-listed address, or a failed contract lookup → flash
|
||||
message, no screen change
|
||||
- "Add" by contract address, then a network switch in Settings before the
|
||||
|
||||
Reference in New Issue
Block a user