fix/recipient-confirm-timer#497
Merged
Jagadeeshftw merged 5 commits intoJun 29, 2026
Merged
Conversation
…ient-confirm-timer fix(recipient): clean up and configure withdrawal reset timer
…fix/recipient-confirm-timer Revert "fix(recipient): clean up and configure withdrawal reset timer"
Closed
4 tasks
Contributor
|
the confirm timer fix looks solid -- having that visual countdown on the confirmation step makes the UX much clearer, especially when the window is short. rebased on top of current main before merging. thanks for the clean implementation! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #450
This pr #450
Implemented a robust timer cleanup and configurable reset delay for the withdrawal confirmation flow:
Timer Management
Added timeoutRef (useRef) to store the setTimeout handle.
Implemented a cleanup useEffect that clears the timeout on component unmount, preventing state updates on unmounted components.
Guarded against overlapping timers by clearing any existing timeout before scheduling a new one.
Configurable Delay
Introduced TRANSACTION_RESET_DELAY_MS in src/lib/transactionConfig.ts (default 5000 ms) and used it in Recipient.tsx instead of the hard‑coded value.
Tests Updated
Added mocks for wallet, toast, and withdraw functions.
Utilized vi.useFakeTimers() to verify the delayed reset behavior, successful withdrawal handling, and timeout cleanup on unmount.
Ensured no regression with accessibility (axe) test.
Changes Summary
src/lib/transactionConfig.ts – new TRANSACTION_RESET_DELAY_MS constant.
src/pages/Recipient.tsx – added timeoutRef, cleanup effect, and configurable delay usage.
src/pages/tests/Recipient.test.tsx – expanded test suite covering timer behavior and unmount cleanup.
All tests pass (npm test) and the UI no longer emits unmount warnings. This PR resolves the issue described in the original ticket.