Skip to content

Fix: api.getWallet() has no AbortSignal parameter — cannot be cancelled on navigation #593

Description

@henrypeters

Category: Frontend - Bug
Priority: Medium
Estimated Time: 30 minutes

Description:
In lib/api.ts, api.getWallet() and api.createWallet() are the only API calls that do not accept an AbortSignal. Every other call (getMe, getBalances, listTransactions, etc.) already threads through a signal. This inconsistency means any component that calls getWallet cannot cancel in-flight requests on unmount or navigation, causing potential state updates on unmounted components.

// lib/api.ts
getWallet: (token: string) => request<Wallet>('/wallet', { token }),
createWallet: (token: string) => request<Wallet>('/wallet/create', { method: 'POST', body: {}, token }),

Tasks:

  • Add signal?: AbortSignal to getWallet() and createWallet() in lib/api.ts
  • Update WalletPage to pass the signal from an AbortController in useEffect
  • Add a test verifying abort cancels the request

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiAPI route handlersbugSomething isn't workingconcurrencyRace conditions and concurrent state

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions