Skip to content

fix(predict): route Popular Today to Trending#33373

Open
ghgoodreau wants to merge 1 commit into
mainfrom
pred-1087
Open

fix(predict): route Popular Today to Trending#33373
ghgoodreau wants to merge 1 commit into
mainfrom
pred-1087

Conversation

@ghgoodreau

@ghgoodreau ghgoodreau commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

Popular Today and Trending exposed overlapping prediction-market content through separate pages in the feature-flagged Predict homepage redesign. This removes the standalone Popular Today feed and routes its header and topic tags to Trending. Topic selections are passed as the initial Trending filter so the chosen topic remains selected after dynamic filters load. Existing feed=popular-today deeplinks also redirect to Trending while the redesign flag is enabled and retain the legacy market-list fallback while it is disabled.

Changelog

CHANGELOG entry: Opened Popular Today topics in Trending and removed the duplicate Popular Today page

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/PRED-1087

Manual testing steps

Feature: Popular Today navigation on the redesigned Predict homepage

  Background:
    Given the Predict home redesign feature flag is enabled
    And the user is on the redesigned Predict homepage
    And Popular Today topics have loaded

  Scenario: Open a Popular Today topic in Trending
    When the user taps a topic in Popular Today
    Then the Trending page is displayed
    And the selected topic filter is active
    And the market list matches the selected topic

  Scenario: Open Trending from the Popular Today header
    When the user taps the Popular Today section header
    Then the Trending page is displayed
    And the All filter is active

  Scenario: Preserve the existing experience when the redesign is disabled
    Given the Predict home redesign feature flag is disabled
    When the user opens Predict
    Then the legacy Predict market list is displayed

Screenshots/Recordings

Before

N/A - No recording was captured; this change only updates navigation between existing Predict screens.

After

N/A - No recording was captured; this change introduces no visual UI changes.

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • N/A: This is a navigation-only change; no manual Android test was performed.
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • N/A: The behavior does not depend on account, token, or activity volume.
    • 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
    • N/A: This change adds no new operation or performance-sensitive code path.
    • See trace() for usage and addToken for an example

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

Low Risk
Navigation and feed-registry consolidation only; no auth, payments, or new data paths. Deeplink behavior is gated on the existing home redesign flag.

Overview
Removes the duplicate popular-today feed from PREDICT_FEED_IDS and PREDICT_FEED_REGISTRY so Predict only exposes Sports, Politics, Crypto, Live, and Trending as config-driven feeds.

The home Popular today rail is unchanged visually but now opens Trending (feedId: 'trending'), passing initialFilterId when a chip is tapped so the topic stays selected after dynamic filters load. Filter options are sourced from the trending registry entry (shared React Query cache with the full Trending feed).

feed=popular-today deeplinks map to Trending with the same filter param when the home redesign flag is on; with the flag off they still fall back to the legacy market list. Tests and docs/comments are updated accordingly.

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

@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.

@metamask-ci metamask-ci Bot added the team-predict Predict team label Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The PR removes the popular-today feed as a standalone feed and redirects it to the trending feed. Changes span:

  1. feedConfig.ts: Removes popular-today from PREDICT_FEED_IDS and PREDICT_FEED_REGISTRY — this is a breaking removal of a feed type.
  2. handlePredictUrl.ts (critical path in app/core/): Deep link handler now redirects feed=popular-today to feedId: 'trending' instead of feedId: 'popular-today'. This changes deep link routing behavior for Predictions.
  3. PredictPopularTodaySection.tsx: The "Popular Today" home section now navigates to the trending feed instead of popular-today when tapping the header or filter chips.
  4. PredictFeedView.tsx / navigation.ts: Comment/doc updates reflecting the removal.
  5. All test files updated to match new behavior.

Tag selection rationale:

  • SmokePredictions: Directly affected — feed navigation, deep link handling, and the Popular Today section all changed. The popular-today feed is removed and redirected to trending. This must be validated.
  • SmokeWalletPlatform: Per SmokePredictions tag description, "Predictions is also a section inside the Trending tab (SmokeWalletPlatform); changes to Predictions views affect Trending." The Popular Today section now navigates to Trending, making this integration critical to verify.
  • SmokeConfirmations: Per SmokePredictions tag description, "opening/closing positions are on-chain transactions — also select SmokeConfirmations." This is a required dependent tag.

No other areas (accounts, swaps, browser, snaps, network, etc.) are affected by these changes.

Performance Test Selection:
The changes remove a feed configuration entry and redirect a deep link — no performance-sensitive code paths are modified. There are no changes to rendering loops, data fetching strategies, asset loading, or app launch flows. The @PerformancePredict tag covers prediction market list loading and deposit flows, but the changes here are purely about feed routing/navigation (popular-today → trending redirect), not about the performance of those flows. No performance tests are warranted.

View GitHub Actions results

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Flaky unit test detection

Run history flaky detection

View recent run history

Historical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow.

Failures / runs sampled per window:

File 7d 15d 30d
app/core/DeeplinkManager/handlers/legacy/__tests__/handlePredictUrl.test.ts 0/116 0/172 0/375

AI-detected flaky patterns

app/core/DeeplinkManager/handlers/legacy/__tests__/handlePredictUrl.test.ts

  • J3 — Missing jest.clearAllMocks() / jest.resetAllMocks() (high)
    • Tests set jest.mocked(selectPredictWorldCupConfig).mockReturnValue(...) (and for selectPredictHomeRedesignEnabledFlag) only in some it() blocks (e.g. World-Cup enabled cases and redesign-flag tests). The shared beforeEach performs only clearAllMocks() (which does not reset mock implementations) and supplies no consistent default for the selectors. No afterEach with resetAllMocks. Mock state therefore leaks between tests, producing order-dependent behavior. This matches J3 exactly. No other J1-J10 patterns matched in this file or any of the other four test files (they use beforeEach resets where needed, waitFor( () => expect(...) ), act() for updates, no timers/sleeps/non-deterministic data/mutable module lets without reset/spyOn without restore). History JSON showed zero failures for all files (hint not used).
    • Suggested fix in app/core/DeeplinkManager/handlers/legacy/__tests__/handlePredictUrl.test.ts:
      -  beforeEach(() => {
      -    jest.clearAllMocks();
      -    mockNavigate = jest.fn();
      -    NavigationService.navigation = {
      -      navigate: mockNavigate,
      -    };
      -  });
      -
      +  beforeEach(() => {
      +    jest.clearAllMocks();
      +    jest.mocked(selectPredictWorldCupConfig).mockReturnValue(DEFAULT_PREDICT_WORLD_CUP_FLAG);
      +    jest.mocked(selectPredictHomeRedesignEnabledFlag).mockReturnValue(true);
      +    mockNavigate = jest.fn();
      +    NavigationService.navigation = {
      +      navigate: mockNavigate,
      +    };
      +  });
      +
      +  afterEach(() => {
      +    jest.resetAllMocks();
      +  });
      +

This check is informational only and does not block merging.

@sonarqubecloud

Copy link
Copy Markdown

@ghgoodreau ghgoodreau marked this pull request as ready for review July 15, 2026 19:48
@ghgoodreau ghgoodreau requested review from a team as code owners July 15, 2026 19:48
@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low AI analysis: low risk size-M team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant