fix: WaitTx 60s timeout overwrites an already-rendered success screen #155
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
In
src/popup/views/txStatus.js:69-87, a single poll tick can render bothoutcomes. When a receipt is found the code calls
showSuccess(...)(
txStatus.js:73) but then falls through to the elapsed-time check attxStatus.js:79-86. On the tick that coincides with the 60-second deadline italso calls
showError(...), replacing the just-rendered "TransactionConfirmed" screen with "not confirmed within 60 seconds".
The user's transaction succeeded and they are told it did not. Given the
screen also carries the tx hash and etherscan link, this is actively
misleading at the worst possible moment.
Separately,
wait-txis not inRESTORABLE_VIEWS(src/popup/index.js:104-115)and its timers live only in the popup, so closing the popup while waiting
silently abandons the poll.
README.md:415-418specifies polling every 10seconds with a transition to SuccessTx on receipt, which does not survive a
popup close today.
Implementation requirements
return(or otherwise make the success and timeout branchesmutually exclusive) so a tick can only ever produce one outcome. Clear the
poll interval on both paths so no timer outlives the view.
receipt lookup is in flight should not clobber a subsequent success, and
vice versa. Guard with a single "already resolved" flag rather than
scattering returns.
wait-txtoRESTORABLE_VIEWSand rehydrate the poll from persistedstate on popup open; or
The background option is more correct and matches how approvals already
work, but note it interacts with the MV3 service-worker lifetime issue
tracked separately — do not depend on
setIntervalsurviving in the worker.State the choice and rationale in the PR.
Definition of done
user on the "Transaction Confirmed" screen. Covered by a unit test with
faked timers.
tx hash and etherscan link.
the wait (or the PR documents the chosen alternative and it is
implemented).
TODO.mdupdated in the same commit.make checkpasses.