Skip to content

fix: cancel in-flight DashboardPage lookups with AbortController (Fixes #203) - #218

Open
waterWang wants to merge 1 commit into
Stellar-Deejah:mainfrom
waterWang:fix/dashboard-lookup-abort-203
Open

fix: cancel in-flight DashboardPage lookups with AbortController (Fixes #203)#218
waterWang wants to merge 1 commit into
Stellar-Deejah:mainfrom
waterWang:fix/dashboard-lookup-abort-203

Conversation

@waterWang

Copy link
Copy Markdown

Summary

Fixes #203DashboardPage.lookup() never cancelled in-flight fetches, so rapid re-lookups ran concurrent requests and the last-resolving (potentially stale) response won. It also had no guard against state updates after unmount.

Changes

  • AbortController-based cancellation: each new lookup aborts the previous in-flight request before starting, so stale responses can never overwrite newer results
  • Signal propagation: the controller's signal is passed to both the enrollments fetch and the escrow-enrichment fetches inside Promise.all, so cancellation covers the whole lookup pipeline
  • State-update guard: signal.aborted is checked before setting records/loading in the catch/finally blocks — this covers both the re-lookup race and the unmount race (an unmount cleanup effect aborts the controller)
  • useCallback: lookup is now memoized with publicKey as its dependency, enabling correct memoization if passed to child components

Verification

  • npx tsc --noEmit — clean
  • npx vitest run — 40/40 tests pass, including the existing DashboardPage accessibility/error-announcement test

- Abort the previous fetch when the user triggers a new lookup so stale
  responses can't overwrite newer results
- Reuse the controller's signal for the escrow enrichment fetches
- Guard state updates with signal.aborted (covers unmount + re-lookup races)
- Wrap lookup in useCallback to enable stable memoization

Fixes Stellar-Deejah#203
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

@waterWang is attempting to deploy a commit to the Deejah Team on Vercel.

A member of the Team first needs to authorize it.

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.

Frontend: DashboardPage lookup has no AbortController — in-flight fetch not cancelled on rapid re-lookups

1 participant