Skip to content

fix(frontend): cancel exponential-backoff poll on unmount/wallet chan… - #1418

Merged
K1NGD4VID merged 1 commit into
LabsCrypt:mainfrom
GOE001:fix/1209-cancellable-poll-withdraw
Sep 2, 2026
Merged

fix(frontend): cancel exponential-backoff poll on unmount/wallet chan…#1418
K1NGD4VID merged 1 commit into
LabsCrypt:mainfrom
GOE001:fix/1209-cancellable-poll-withdraw

Conversation

@GOE001

@GOE001 GOE001 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

…ge (#1209)

The pollIndexerForWithdraw loop could run for ~63s with no abort mechanism, causing stale fetches and state writes after the user navigated away or switched wallets.

  • Thread an AbortController through the polling loop via a useRef
  • Abort on component unmount and wallet/publicKey change via useEffect cleanup
  • Check signal.aborted before each fetch, state update, and after delay
  • Add test verifying unmount mid-backoff stops further fetches

Description

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or update

Related Issues

Closes #1209

Changes Made

Testing

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Test Steps

Breaking Changes

Breaking Changes:

Migration Guide:

Screenshots/Demo

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Updated Postman/Hoppscotch API collections if routes changed
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have checked for breaking changes and documented them if applicable

Additional Notes

…ge (LabsCrypt#1209)

The pollIndexerForWithdraw loop could run for ~63s with no abort
mechanism, causing stale fetches and state writes after the user
navigated away or switched wallets.

- Thread an AbortController through the polling loop via a useRef
- Abort on component unmount and wallet/publicKey change via useEffect cleanup
- Check signal.aborted before each fetch, state update, and after delay
- Add test verifying unmount mid-backoff stops further fetches

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@K1NGD4VID
K1NGD4VID merged commit d8a7880 into LabsCrypt:main Sep 2, 2026
10 of 11 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.

[Audit] Unbounded, un-cancellable exponential-backoff poll after a withdrawal

2 participants