Skip to content

fix(predict): stop game details jump and chart overlap on tab switch cp-7.81.0#31436

Merged
caieu merged 1 commit into
mainfrom
predict/PRED-954-fix-screen-jumping-when-switching-tabs-between-game-lines-exact-score-and-halftime
Jun 10, 2026
Merged

fix(predict): stop game details jump and chart overlap on tab switch cp-7.81.0#31436
caieu merged 1 commit into
mainfrom
predict/PRED-954-fix-screen-jumping-when-switching-tabs-between-game-lines-exact-score-and-halftime

Conversation

@caieu

@caieu caieu commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

This PR makes the Predict game details screen (PredictGameDetailsContent) behave like the standard PredictMarketDetails screen when switching between outcome-group chips (game lines / exact score / halftime) or the Positions/Outcomes tabs. It fixes two visual issues:

  1. Screen jumping on tab/chip change. The component drove an imperative scrollTo on every chip selection (plus a follow-up InteractionManager.runAfterInteractions pass) to force the sticky header to the top, propped up by a windowHeight-based minHeight on the tab content. This caused the screen to jump downward on every switch. The regular market details screen never does this — it relies solely on the ScrollView's stickyHeaderIndices. Removed the manual scroll machinery (scrollRef, stickyHeaderY, pendingChipScroll, the layout handler, and the effect) and the minHeight wrapper, so switching chips/tabs now only swaps the content below the sticky header and preserves scroll position.

  2. Chart overlapping the outcomes. PredictGameChartContent used flex-1 on its loaded/error/empty containers. Inside a ScrollView, flex-1 collapses to zero height, so the fixed 200px chart View overflowed downward onto the chip bar and the first outcome card. Switched the containers to w-full so they size to their content — matching the market details chart (PredictDetailsChart), which never used flex-1.

Both changes are layout-only. Existing unit tests for PredictGameChart and PredictGameDetailsContent (218 tests) pass unchanged, including the reserves chart height only while loading test.

Changelog

CHANGELOG entry: Fixed the Predict sports game details screen jumping and the price chart overlapping the outcomes when switching between markets

Related issues

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

Manual testing steps

Feature: Predict game details market/tab switching

  Scenario: Switching outcome-group chips does not jump or overlap the chart
    Given I open a sports game market with extended outcomes (e.g. game lines, exact score, halftime)
    And the price chart has loaded above the chip bar

    When I tap a different chip (e.g. "Exact Score")
    Then the screen does not jump to pin the chip bar to the top
    And the chart keeps its height and does not overlap the outcomes list
    And the outcomes for the selected chip render below the chip bar

  Scenario: Switching Positions/Outcomes tabs preserves scroll position
    Given I open a sports game market that shows the Positions/Outcomes tab bar

    When I switch between the Positions and Outcomes tabs
    Then the scroll position is preserved (no downward jump)
    And the chart does not overlap any content

Screenshots/Recordings

Before

After

Screen.Recording.2026-06-09.at.18.05.28.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

Low Risk
Layout-only Tailwind and scroll wiring changes in Predict game details UI with no auth, data, or business-logic impact.

Overview
Fixes Predict game details layout when users switch outcome chips or Positions/Outcomes tabs.

Game details scroll behavior: Removes imperative scrollTo on chip change (scrollRef, stickyHeaderY, pendingChipScroll, layout measurement, and InteractionManager follow-up) and drops the windowHeight-based minHeight wrapper around tab content. Chip selection now calls handleChipSelect directly, relying on ScrollView stickyHeaderIndices like standard market details so scroll position is preserved and the screen no longer jumps.

Chart in ScrollView: In PredictGameChartContent, replaces flex-1 with w-full on loaded, error, and empty chart containers so height follows content instead of collapsing inside the scroll view, preventing the fixed-height chart from overlapping the chip bar and outcome list.

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

Switching between outcome-group chips (game lines / exact score / halftime)
made the screen jump down and the price chart bleed over the outcomes list.
Two independent causes:
- PredictGameDetailsContent fired an imperative scrollTo on every chip
  selection (plus a follow-up InteractionManager pass) to pin the sticky
  header to the top, propped up by a windowHeight-based minHeight on the tab
  content. That produced the downward jump. Removed the manual scroll
  machinery and the minHeight wrapper and now rely solely on the ScrollView's
  stickyHeaderIndices, matching how PredictMarketDetails handles stickiness.
- PredictGameChartContent used flex-1 on its loaded/error/empty containers.
  Inside a ScrollView flex-1 collapses to zero height, so the fixed 200px
  chart View overflowed onto the chips and first outcome card. Switched to
  w-full so the container sizes to its content, as the market details chart
  already does.
Tests: PredictGameChart + PredictGameDetailsContent suites pass (218 tests).
@github-actions

github-actions Bot commented Jun 9, 2026

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.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-predict Predict team label Jun 9, 2026
@github-actions github-actions Bot added the size-S label Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The two changed files are both within the Predict feature area (Polymarket prediction market integration):

  1. PredictGameChartContent.tsx: Minor layout fix changing flex-1 to w-full in three render paths (error state, no-data state, normal state). This is a pure CSS/Tailwind layout adjustment with no logic changes.

  2. PredictGameDetailsContent.tsx: Removes the auto-scroll-to-sticky-header behavior when a chip is selected. This removes useWindowDimensions, useRef, useState, useEffect, InteractionManager, and the minHeight wrapper around PredictGameDetailsTabsContent. The chip selection now directly calls handleChipSelect instead of the custom onChipSelect wrapper that triggered scroll behavior.

Both changes are UI/layout improvements contained within the Predict feature. They could affect how the prediction market details screen renders and scrolls.

Tag selection rationale:

  • SmokePredictions: Directly tests the Polymarket prediction market integration, including position lifecycle flows that use these components.
  • SmokeWalletPlatform: Required per SmokePredictions description — Predictions is a section inside the Trending tab, so changes to Predictions views affect Trending.
  • SmokeConfirmations: Required per SmokePredictions description — opening/closing positions are on-chain transactions that go through confirmations.

No other tags are warranted as the changes are isolated to the Predict UI components with no impact on core wallet infrastructure, accounts, networks, or other features.

Performance Test Selection:
The changes are minor UI layout fixes (flex-1 to w-full) and removal of scroll behavior logic. There are no changes to data loading, state management, list rendering, or any performance-critical paths. No performance tests are warranted.

View GitHub Actions results

@caieu caieu marked this pull request as ready for review June 9, 2026 21:50
@caieu caieu requested a review from a team as a code owner June 9, 2026 21:50
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jun 9, 2026
@caieu caieu added this pull request to the merge queue Jun 10, 2026
@caieu caieu removed this pull request from the merge queue due to a manual request Jun 10, 2026
@caieu caieu changed the title fix(predict): stop game details jump and chart overlap on tab switch fix(predict): stop game details jump and chart overlap on tab switch cp-7.81.0 Jun 10, 2026
@caieu caieu added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 5f729ed Jun 10, 2026
128 checks passed
@caieu caieu deleted the predict/PRED-954-fix-screen-jumping-when-switching-tabs-between-game-lines-exact-score-and-halftime branch June 10, 2026 14:43
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 10, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.82.0 Issue or pull request that will be included in release 7.82.0 label Jun 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.82.0 Issue or pull request that will be included in release 7.82.0 risk:medium AI analysis: medium risk size-S team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants