Skip to content

fix/recipient-confirm-timer#497

Merged
Jagadeeshftw merged 5 commits into
Fluxora-Org:mainfrom
egwujiohaifesinachiperpetual-max:main
Jun 29, 2026
Merged

fix/recipient-confirm-timer#497
Jagadeeshftw merged 5 commits into
Fluxora-Org:mainfrom
egwujiohaifesinachiperpetual-max:main

Conversation

@egwujiohaifesinachiperpetual-max

Copy link
Copy Markdown
Contributor

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.

@Jagadeeshftw

Copy link
Copy Markdown
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!

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.

Make the Recipient.tsx withdrawal confirmation auto-reset timeout configurable and cleaned up

3 participants