fix(predict): reset active order state on payment token clear and suppress stale balance alert cp-7.73.0#28491
Merged
Merged
Conversation
`resetSelectedPaymentToken` was calling `setSelectedPaymentToken(null)` which only clears the token without transitioning the active order state machine. This left `activeOrder.state` stuck at `pay_with_any_token` when the user had enough predict balance to cover the bet. Route `resetSelectedPaymentToken` through `selectPaymentToken(null)` instead, which treats null as a balance token selection and properly transitions `PAY_WITH_ANY_TOKEN → PREVIEW`.
The insufficient pay token balance alert was firing with a stale deposit amount because it only syncs to TransactionPayController when the input loses focus. Gate the alert behind `isInputFocused` so it only appears after the user finishes editing.
Contributor
|
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. |
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - draft PR All E2E tests pre-selected. |
matallui
approved these changes
Apr 7, 2026
|
Contributor
|
✅ E2E Fixture Validation — Schema is up to date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes two issues in the Predict buy flow when using the pay-with-any-token feature:
Changes
Changelog
CHANGELOG entry: null
Related issues
Fixes: #28492
#28493
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches the Predict buy flow state machine and error handling; small but user-facing behavior changes could affect order transitions and when balance errors are shown.
Overview
Fixes the Predict pay-with-any-token buy flow so clearing the payment token (passing
null) is treated as selecting Predict balance, which also resets the active order fromPAY_WITH_ANY_TOKENback toPREVIEW.Updates
usePredictPaymentToken.resetSelectedPaymentTokento route throughselectPaymentToken(null)(instead of directly setting state), and adds anisInputFocusedgate inusePredictBuyErrorto suppress the insufficient pay-token balance alert while the amount input is being edited. Tests were updated to cover the newnullbehavior and the input-focus suppression.Reviewed by Cursor Bugbot for commit 75fc16f. Bugbot is set up for automated code reviews on this repo. Configure here.