Skip to content

fix(useBountyStatus): retain live bounty state and surface error on transient poll failures (#571) - #583

Open
PINYOPATTANAWASANPORN wants to merge 3 commits into
MergeFi:mainfrom
PINYOPATTANAWASANPORN:fix/use-bounty-status-fallback-retention-571
Open

PINYOPATTANAWASANPORN wants to merge 3 commits into
MergeFi:mainfrom
PINYOPATTANAWASANPORN:fix/use-bounty-status-fallback-retention-571

Conversation

@PINYOPATTANAWASANPORN

Copy link
Copy Markdown

Summary of Changes

  • Export fetchLiveBounty(id) in src/lib/api.ts to allow throwing live requests during active polling (#571).
  • Update useBountyStatus to only permit fallbackBounty before initial live resolution.
  • Ensure mid-session transient network or HTTP failures throw errors to useSmartPolling so live data (status: claimed) is preserved, error is surfaced, and false onStatusChange events are avoided.
  • Add comprehensive unit test suite in src/hooks/useBountyStatus.test.ts.

Root Cause / Technical Context

Previously, useBountyStatus called fetchBounty inside its polling loop, which caught all errors and resolved with the initial static fallbackBounty. This caused transient mid-session network drops to silently swap live bounty states back to static defaults, firing false status regression events.

Verification & Testing

  • Unit tests verify:
    1. Initial mount gracefully uses fallback when network is unavailable.
    2. Transient poll errors after live resolution preserve live status, set error, and do not call onStatusChange.
    3. Subsequent poll recovery clears error and maintains data freshness.

@vercel

vercel Bot commented Oct 5, 2026

Copy link
Copy Markdown

@PINYOPATTANAWASANPORN is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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