Skip to content

fix(predict): fix Add Funds and Withdraw navigation when rendered inside Discovery Tabs#30271

Open
vinnyhoward wants to merge 5 commits into
mainfrom
fix-753-predict-funds-broken-route
Open

fix(predict): fix Add Funds and Withdraw navigation when rendered inside Discovery Tabs#30271
vinnyhoward wants to merge 5 commits into
mainfrom
fix-753-predict-funds-broken-route

Conversation

@vinnyhoward
Copy link
Copy Markdown
Contributor

@vinnyhoward vinnyhoward commented May 15, 2026

Description

When PredictFeed is rendered inside HomepageDiscoveryTabs (the coreMCU589AbtestHubPageDiscoveryTabs A/B test), the "Add funds" and "Withdraw" buttons were broken.

Root cause: usePredictDeposit and usePredictWithdraw called navigateToConfirmation without a stack, so React Navigation tried to resolve RedesignedConfirmations from the Wallet navigator scope where it isn't registered, instead of the Predict stack.

Fix: hardcoded stack: Routes.PREDICT.ROOT directly in both hooks, matching the same pattern Perps hooks already use. Also fixed PredictWorldCupMainFeedBanner which had the same issue navigating to Routes.PREDICT.WORLD_CUP without a stack. All existing behavior is preserved since React Navigation handles navigating to an already-active stack gracefully.

Changelog

CHANGELOG entry:null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-753

Manual testing steps

Feature: Predict Add Funds / Withdraw under Discovery Tabs

  Scenario: user taps Add Funds on the Predictions tab
    Given the coreMCU589AbtestHubPageDiscoveryTabs flag is enabled
    And user is on the Predictions tab with a funded account
    When user taps "Add funds"
    Then the deposit confirmation screen opens

  Scenario: user taps Withdraw on the Predictions tab
    Given the coreMCU589AbtestHubPageDiscoveryTabs flag is enabled
    And user is on the Predictions tab with a non-zero balance
    When user taps "Withdraw"
    Then the withdraw confirmation screen opens

  Scenario: default Predict stack behavior is unchanged
    Given the coreMCU589AbtestHubPageDiscoveryTabs flag is disabled
    When user taps "Add funds" or "Withdraw" from the standard Predict screen
    Then the confirmation screen opens as before

Screenshots/Recordings

Simulator.Screen.Recording.-.iPhone.17.Pro.Max.-.2026-05-15.at.13.03.08.mov

Before

Tapping "Add funds" / "Withdraw" does nothing

Screen.Recording.2026-05-15.at.10.12.07.mov

After

Both buttons navigate correctly to the confirmation screen.

Simulator.Screen.Recording.-.iPhone.17.Pro.Max.-.2026-05-15.at.13.03.08.mov

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Updates navigation targets for deposit/withdraw confirmation flows and the World Cup banner to explicitly route via the Predict stack; risk is moderate because it touches user-facing navigation for financial actions but is a small, scoped change.

Overview
Fixes Predict navigation when rendered outside the Predict navigator (e.g., inside Discovery tabs) by explicitly targeting the Predict stack.

usePredictDeposit and usePredictWithdraw now pass stack: Routes.PREDICT.ROOT to navigateToConfirmation, and PredictWorldCupMainFeedBanner now navigates via navigation.navigate(Routes.PREDICT.ROOT, { screen: Routes.PREDICT.WORLD_CUP }). Related tests were updated to assert the new navigation arguments.

Reviewed by Cursor Bugbot for commit a8fa2da. Bugbot is set up for automated code reviews on this repo. Configure here.

@vinnyhoward vinnyhoward requested review from a team as code owners May 15, 2026 18:35
@github-actions
Copy link
Copy Markdown
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.

@metamaskbotv2 metamaskbotv2 Bot added the team-mobile-ux Mobile UX team label May 15, 2026
@github-actions github-actions Bot added size-S and removed size-M labels May 15, 2026
@vinnyhoward vinnyhoward added the team-predict Predict team label May 15, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 cebaecf. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeConfirmations, SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR fixes navigation routing within the Predict (Polymarket) feature:

  1. PredictWorldCupMainFeedBanner.tsx: Changed navigation.navigate(Routes.PREDICT.WORLD_CUP) to navigation.navigate(Routes.PREDICT.ROOT, { screen: Routes.PREDICT.WORLD_CUP }) - fixes navigation to properly use the Predict stack navigator rather than navigating directly to a screen outside the stack context.

  2. usePredictDeposit.ts: Added stack: Routes.PREDICT.ROOT to navigateToConfirmation() - ensures the confirmation flow knows to return to the Predict stack after deposit confirmation.

  3. usePredictWithdraw.ts: Same fix as deposit - added stack: Routes.PREDICT.ROOT to navigateToConfirmation() for withdraw flows.

These are navigation correctness fixes that affect:

  • SmokePredictions: Directly impacts prediction market flows (opening/closing positions, deposits, withdrawals) - the core feature being fixed.
  • SmokeConfirmations: Deposit and withdraw flows navigate through the confirmation system with the new stack parameter - must verify confirmations still work correctly and return to the right screen.
  • SmokeWalletPlatform: Per SmokePredictions tag description, "When selecting SmokePredictions, also select SmokeWalletPlatform (Trending section)" since Predictions is embedded in the Trending tab.

No other areas are affected - changes are isolated to Predict component navigation and hooks. No performance impact expected from navigation routing fixes.

Performance Test Selection:
These changes are purely navigation routing fixes (changing how screens are navigated to within the Predict stack). There is no UI rendering, data loading, list rendering, or state management changes that would impact performance metrics. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-S team-mobile-ux Mobile UX team team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant