Skip to content

Fix/balance refetch timing#266

Merged
Mosas2000 merged 31 commits intomainfrom
fix/balance-refetch-timing
Mar 14, 2026
Merged

Fix/balance refetch timing#266
Mosas2000 merged 31 commits intomainfrom
fix/balance-refetch-timing

Conversation

@Mosas2000
Copy link
Copy Markdown
Owner

Closes #243

refetchBalance() was called in onFinish, which fires as soon as the
wallet broadcasts the transaction. At this point the transaction has
not been mined yet, so the API returns the same (stale) balance.

This could mislead users into thinking the tip was not processed
or that they have more funds available than they actually do.

Refs #243
Move the balance refresh into handleTxConfirmed, which is called by
the TxStatus component only after the Stacks API reports the
transaction as 'success'. The balance now reflects the actual
on-chain state.

Closes #243
When a transaction is aborted, the balance might have changed due
to fees or if another transaction was processed concurrently.
Refreshing after failure ensures accuracy.
When a transaction has been broadcast but not yet confirmed, display
a subtle 'Pending confirmation' note below the balance. This sets
the user's expectation that the shown balance may be stale.
Records when the balance was last successfully fetched so consumers
can determine staleness.
Set MAX_RETRIES=2 and RETRY_DELAY_MS=1500 for balance fetch
retries on transient network failures.
The balance fetch now retries up to MAX_RETRIES times with a
RETRY_DELAY_MS delay between attempts. This handles transient
network errors and brief API unavailability without surfacing
errors to the user on the first failure.
Tests can now assert the transaction status without parsing CSS
classes or label text.
Screen readers will announce the element as busy while the
transaction is pending, then announce the final status when it
changes.
Displays a subtle (n/60) counter so users can see the component
is actively checking. Reduces anxiety about whether the status
is being monitored.
Inform users that Stacks blocks typically take 10-30 minutes.
This sets proper expectations and reduces premature 'is it stuck'
concerns.
@Mosas2000 Mosas2000 merged commit c45496c into main Mar 14, 2026
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Balance refetch fires before transaction is mined, showing stale data

1 participant