Skip to content

fix: add timeout/error handling for currency rate and limits API calls #1848

Description

@chip-peanut-bot

Problem

Both the Manteca add-money flow and Bridge bank flow call:

  1. useCurrency()getCurrencyPrice() for exchange rates
  2. useLimitsValidation()useLimits()/users/limits API

If either API call hangs or is slow (common on budget Android with spotty connections):

  • InputAmountStep shows <PeanutLoading /> indefinitely while currencyData.isLoading
  • The page appears blank/frozen with no way to interact

Neither call has a timeout, and there's no fallback UI for failed fetches.

Fix

  • Add AbortController timeout (e.g. 10s) to getCurrencyPrice() in useCurrency.ts
  • Add error/timeout state to InputAmountStep — show the amount input with a retry button for the rate instead of blocking the entire page
  • Consider adding retry: 1 and retryDelay: 2000 to the useQuery in useLimits.ts

Context

User report: app freezes on add-money/withdraw screen. Reproducible on Motorola G31 (Android 12) and G23 (Android 14).
Investigation: https://discord.com/channels/972435984954302464/1486336087747199059/1486337803708141588

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions