Skip to content

test: verify recipient check debounce and abort behavior - #519

Open
ZacLou wants to merge 1 commit into
conduit-protocol:mainfrom
ZacLou:test/recipient-debounce-466
Open

test: verify recipient check debounce and abort behavior#519
ZacLou wants to merge 1 commit into
conduit-protocol:mainfrom
ZacLou:test/recipient-debounce-466

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses #466

Context

The issue asks to confirm that checkRecipientExists still fires once per 600ms of idle (not on every keystroke) and that the in-flight check is aborted when the address changes.

After reviewing the code, the debounce is correctly implemented:

  • useDebounce(recipient, 600) debounces the recipient value
  • The effect depends on debouncedRecipient, not recipient
  • An AbortController is created per effect run with cleanup that aborts on address change
  • The isMounted flag prevents stale state updates

Tests Added

3 new test cases in app/create/__tests__/page.test.tsx:

  1. Does not call checkRecipientExists immediately on keystroke — verifies the mock is not called until the 600ms debounce fires
  2. Fires only one check after rapid keystrokes — types 5 keystrokes within the debounce window, verifies only one check fires
  3. Aborts the in-flight check when the address changes mid-debounce — types first address, waits for debounce, changes address, verifies only the new address triggers a check

No production code changes

The implementation is correct — these tests provide regression coverage to prevent future debounce breakage.

Confirms checkRecipientExists fires once per 600ms of idle (not per
keystroke) and that the in-flight check is aborted when the address
changes mid-debounce.

Addresses conduit-protocol#466
@ZacLou
ZacLou force-pushed the test/recipient-debounce-466 branch from 369a9dc to e1d5940 Compare September 5, 2026 11:19
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.

1 participant