fix(predict): prevent duplicate Predict claim requests during pending state#27133
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27133 +/- ##
===========================================
- Coverage 81.52% 71.23% -10.30%
===========================================
Files 4626 4658 +32
Lines 121238 121982 +744
Branches 26642 26819 +177
===========================================
- Hits 98845 86892 -11953
- Misses 15446 28544 +13098
+ Partials 6947 6546 -401 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|



Description
Summary
isClaimPendingstate tousePredictClaimto prevent concurrent claim executions from repeated taps.claim()when a claim is already in flight, and always reset pending state in afinallyblock.void claim().Tests
usePredictClaimtests to validate pending-state behavior:isClaimPending = falseclaim()call while pendingact(...)to ensure stable React state assertions in hook tests.Why
Repeated taps on Predict claim could trigger multiple confirmation flows. This change enforces a single in-flight claim request and avoids duplicate claim confirmations.
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/PRED-739
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches claim/transaction flow by adding per-account pending-claim tracking in
PredictControllerand wiring it through UI/hook logic; bugs here could block or duplicate user claim attempts despite added tests.Overview
Prevents duplicate claim submissions by adding non-persisted
pendingClaimsstate toPredictController, short-circuitingclaimWithConfirmationwhen a claim is already in flight, and clearing pending state on errors and on terminal transaction status updates.Propagates claim-pending state to the UI via a new
selectPredictPendingClaimByAddressselector andusePredictClaim.isClaimPending, showing an “in progress” toast on repeat taps and rendering claim buttons in a disabled loading state (spinner + newpredict.claiming_text), including privacy-mode hiding of amounts.Refactors market/positions claim CTAs to reuse
PredictClaimButtonand threadsisClaimPendingthroughPredictActionButtons, game details, sport card footer, and market details actions, with updated/added tests covering the new behavior and edge cases.Written by Cursor Bugbot for commit 5678560. This will update automatically on new commits. Configure here.