fix: reject predictDepositAndOrder before opening Add Funds flow#30508
Conversation
predictDepositAndOrder before opening Add Funds flow
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5d1aa3c. Configure here.
5d1aa3c to
f4d9f81
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
The risk is medium because the change modifies a user flow (Add Funds from within a prediction confirmation) by adding approval rejection before navigation, which could affect the confirmation state machine if not handled correctly. Performance Test Selection: |
|



Description
When the user taps "Add" on the Predict balance row in the pay-with picker during a
predictDepositAndOrderconfirmation, the existing flow creates apredictDeposittransaction on top of the activepredictDepositAndOrderconfirmation. This causes two issues:Fix
Mirror the Perps pattern (
usePerpsBalanceTokenFilter):dismissActivePreviewSheet()- instantly removes thePredictPreviewSheetoverlay (module-level function that callssetBuyParams(null)on the active provider)onReject()- rejects the existingpredictDepositAndOrderapprovalnavigation.navigate(ADD_FUNDS_SHEET)- opens the deposit flow cleanlyChanges
usePredictBalanceTokenFilter.ts-handleAddFundsnow callsdismissActivePreviewSheet()+onReject()before navigating to Add FundsPredictPreviewSheetContext.tsx- ExtendedSheetModeProviderEntrywithdismissPreviewSheetcallback; added exporteddismissActivePreviewSheet()function that dismisses the active provider's sheet from anywhere (including outside the context tree)contexts/index.ts- ExportdismissActivePreviewSheetusePredictBalanceTokenFilter.test.ts- Updated test to mockuseApprovalRequest,usePredictDeposit, and assertonRejectis calledManual testing steps
predictDepositAndOrderconfirmation are dismissedScreenshots/Recordings
Before
predict.add.funds.before.mp4
After
predict.add.funds.after.mov
Pre-merge author checklist
Run Smoke E2Eand/orRun Full E2Elabel to run smoke/full E2E testsNote
Medium Risk
Changes Predict confirmation flow by programmatically dismissing the active preview sheet and rejecting the current approval before starting the Add Funds navigation; mistakes could interrupt user order/confirmation state or leave UI in an inconsistent dismissal state.
Overview
Prevents stacking a new Add Funds deposit flow on top of an active
predictDepositAndOrderconfirmation when users tap Add on the Predict balance row.Introduces a module-level
dismissActivePreviewSheet()inPredictPreviewSheetContext(tracked per active provider) and updatesusePredictBalanceTokenFilterto callonReject()+dismissActivePreviewSheet()before navigating toADD_FUNDS_SHEET; associated unit test now mocksuseApprovalRequestand asserts both calls occur.Reviewed by Cursor Bugbot for commit f4d9f81. Bugbot is set up for automated code reviews on this repo. Configure here.