fix: delegation confirmation reports a stake migration
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11
- Forks
- 26
- Avg merge
- 11h 58m
- Merged PRs (30d)
- 16
Description
Every plain delegation shows the wrong confirmation:
Congrats! You've successfully migrated your stake to a new orchestrator.
TxConfirmedDialog/index.tsx:120 picks the copy from the recorded amount, which is correct in principle — a genuine "Move Delegated Stake" bonds zero:
Number(tx.inputData.amount) <= 0
? "...migrated your stake to a new orchestrator."
: "...delegated N LPT."
The amount it reads has already been cleared. onDelegate in components/DelegatingWidget/Delegate.tsx calls bondWrite(...) and then reset() → setAmount("") (components/DelegatingWidget/index.tsx:199) without waiting for the hash. useHandleTransaction's useEffect(..., [data]) later stores setLatestTransactionDetails(data, id, args) using the current args, by which point the amount is 0.
The hash can never arrive before reset() runs, so this is deterministic rather than a race.
Reproduction
Delegate any amount to an orchestrator and read the success dialog.
Fix
Capture the args when the transaction is submitted and hand those to useHandleTransaction, so the confirmation reflects what was sent.
Display only — the transaction itself is unaffected. unbond does not share the problem; Undelegate.tsx never calls reset().
Related
- livepeer/explorer#739 — covers the wider transaction lifecycle issues in the same hook (no receipt waiting, no cache invalidation). This is the third item from that issue, split out because it is self-contained.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with TxConfirmedDialog/index.tsx:120 and trace the transaction details supplied by useHandleTransaction. Compare onDelegate in components/DelegatingWidget/Delegate.tsx with reset() in components/DelegatingWidget/index.tsx:199, then capture the submitted args before reset clears the amount. Done means a plain delegation shows the delegated amount while a genuine stake migration still shows its migration message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100