Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): reduce thread feed scroll jank #4874

Mergedgabrielelpidio(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/4874/headmerged by gabrielelpidio(GitHub profile, opens in a new tab) View on GitHub

What Changed

  • Reduced visible scroll jumps in the mobile thread feed by using fixed heights for predictable rows and measuring content ahead of the viewport.
  • Disabled layout animations while browsing thread history, while preserving smooth animations near the latest messages.
  • Improved short-thread bottom alignment and filtered neutral tool activity rows from work logs.
  • Updated file preview editor integration and simplified Git diff/stat handling.
  • Reverted package versions and aligned the Pierre Diffs patch with the current dependency version.

Why

Scrolling upward through older, unmeasured thread content caused row size corrections to visibly shift the feed. Predictable row sizing, ahead-of-viewport measurement, and conditional layout animation keep history browsing stable without sacrificing smooth updates during active streaming.

UI Changes

No screenshots or video included. The mobile thread feed scroll behavior and file preview editor integration were adjusted.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Medium Risk Changes scroll positioning, list virtualization sizing, and layout animation timing in a complex LegendList setup; regressions would show as scroll jumps or misaligned short-thread layout, not security issues.

Overview Reduces upward-scroll jank in the mobile thread feed by teaching LegendList predictable heights for chrome rows and by only running layout animations when the user is near the latest messages.

ThreadFeed replaces the always-on LinearTransition with a scroll-gated feedItemLayoutTransition worklet: 180ms slides when within about one screen of the list end, 0ms while reading history so maintainVisibleContentPosition offset fixes don’t fight animated moves. It adds getFixedItemSize for turn folds, work toggles, the working row, and collapsed activity groups (using collapsedWorkLogHeight and scaled typography), drawDistance={500} for offscreen measurement, and alignItemsAtEnd so short threads sit above the composer.

thread-work-log centralizes filtering in visibleWorkLogActivities, exports height helpers shared with the feed, and uses the same filter when rendering.

appearancePreferences adds scaledTypographyLineHeight and routes text-scale line-height variables through it so fixed row heights stay aligned with the user’s base font size.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ca5441e0c860187a10692e5fb71b2fe504449c3a. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Reduce scroll jank in thread feed by gating layout animations and pre-measuring row heights

  • Adds a feedItemLayoutTransition worklet in ThreadFeed.tsx that only animates layout changes (180ms) when the scroll position is near the end of the list, running instantly (0ms) elsewhere to avoid mid-scroll jank.
  • Adds a getFixedItemSize callback so LegendList can skip async measurement for known fixed-height rows (turn-fold, work-toggle, working, activity-group when fully collapsed).
  • Sets drawDistance={500} to pre-render more offscreen content and alignItemsAtEnd to bottom-align short lists.
  • Exports collapsedWorkLogHeight, visibleWorkLogActivities, and WORK_GROUP_TOGGLE_HEIGHT from thread-work-log.tsx to support pre-measurement of work-log rows.

Changes since #4874 opened

  • Made thread feed row heights scale dynamically with user's base font size preference [ca5441e]
Macroscope summarized d39ce79.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: c7c71d53-d1ad-4d80-91c2-a850b74255a3

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR introduces conditional layout animations and pre-measurement logic for a complex virtualized list. The self-labeled 'Medium Risk' changes to scroll positioning, animation timing, and list virtualization warrant review to ensure no scroll-related regressions.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. the fixed-size approach looks good, but these values need to follow the app's configurable text scale before merge. apps/mobile/src/features/threads/ThreadFeed.tsx:131: text-xs has a 17px line height at default, so WORKING_ROW_HEIGHT is already 1px short: 8 + 17 + 16 = 41. at the supported 22pt base size it becomes 47px. please derive this from scaled typography or leave the row measured. apps/mobile/src/features/threads/thread-work-log.tsx:93: text-2xs is 16px only at default. at 22pt its line height is 22px, making this header 24px rather than 18px. please use the current scaled line height or leave these groups measured.

    5. maria-rcks approved these changes

    6. Addressed the text-scale feedback in ca5441e0c: fixed row heights are now derived from scaledTypographyLineHeight — the same formula resolveTextScaleVariables injects into Uniwind — so the working row and work-log header track the configured base font size exactly (including the 17px text-xs line at default and 22pt maximum). The min-height-clamped rows keep their constants, with the clamp invariant documented at each.

    7. t3-code-bot[bot](GitHub profile, opens in a new tab) approved these changes

      correction: this approval only clears the blocking state i set by mistake. it is not an implementation approval. the font-scale concerns at apps/mobile/src/features/threads/ThreadFeed.tsx:131 and apps/mobile/src/features/threads/thread-work-log.tsx:93 still need addressing.

Sign in to join this conversation.