Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): keep thread scroll bounds current after animations #9013

Mergedjuliusmarmingemerged 8 commits intomain fromrefs/pull/9013/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Problem

Mobile threads could jump when opening work details, returning from sleep, or swiping after the bottom arrow. Cold expansion was worse because hidden rows still used estimated heights. Disclosure animations could overlap text as rows mounted or disappeared, and the work-log spacing was loose.

Fix

  • Keep Reanimated's size style attached and retarget active animations when measurements replace estimates, so native scroll bounds stay current.

  • Reconcile live-follow after disclosures using refreshed end geometry, preserving the reading position on resume.

  • Remove FadeOut from virtualized outer feed rows. Newly mounted or remounted rows fade in after the existing 180 ms layout transition, including a returning final answer. Remove the old entering-ID bookkeeping; retain layout transitions and clipped command-detail fades.

  • Tighten spacing below Worked-for rows, after commentary, and around tool-group toggles. Update the matching fixed-height constants without shrinking touch targets.

  • Key the feed with the existing environment-scoped selectedThreadKey, so disclosure callbacks cannot survive an environment switch.

  • Rotate a stable chevron for Worked-for rows, tool groups, and command details over the existing 180 ms disclosure transition. Preserve icon dimensions, tap targets, and expanded accessibility state; use Reanimated's system reduced-motion setting.

No new test harness. Changes are mobile-only; web/desktop behavior, providers, and wire contracts are unchanged.

Chevron motion

Before eb9067349; after ad27b1b01. The synthetic clips are cropped to the disclosure controls, run at normal speed, and have no audio.

The latest simulator pass opened and closed all three controls. Fold, group, and command-row anchors stayed fixed, and frame-by-frame review confirmed intermediate rotation angles.

Disclosure and spacing comparison

Before fa0926df; after eb9067349. Synthetic iOS Simulator footage, normal speed, silent, with the header cropped. No customer conversation is published.

BeforeAfter
Before: loose spacing below the work summary and around tool groupsAfter: tighter work-log spacing with the same touch targets

Fold and command-group anchors stayed fixed through repeated toggles. Frame-by-frame review covered incoming work rows, moving commentary, and the final answer remounting on collapse. Earlier turns were checked separately.

Prior scroll-fix evidence

The earlier cold-expansion comparison is 479f910 → fa0926df, not the spacing comparison above. First expansion previously moved the anchor 179 points; afterward it stayed at y=250.33 through first expansion, collapse, and second expansion.

Before image · After image · Before first expansion · After first/second expansion · Command output across background/resume.

Original scroll-bounds reproduction: before opening details, after opening details, and bottom arrow followed by swipes.

Verification

  • 59 tests passed across four existing files: the previous 55 follow/presentation/layout tests plus four known-environment tests.
  • Mobile TypeScript, targeted lint/format checks, and git diff --check passed.
  • iOS Simulator: first/second and latest/earlier disclosures, interleaved user messages, command details, bottom arrow/swipes, background/resume, and short-thread alignment. Prior scroll-fix verification also covered thread reopening.
  • New standalone Release installed as T3 Code Dev on the iPhone 16 Pro. All three source files byte-match the build input; OTA updates are disabled. Installation and launch both succeeded; physical-device scrolling remains for manual testing.

Android was not exercised. Native list sizing and disclosure anchoring remain the main regression risks.

Implemented and verified with the Codex harness in T3 Code.


Note

Medium Risk Touches patched LegendList scroll/MVCP and Reanimated list sizing—core thread scrolling on iOS—with hardcoded row height constants that must stay in sync with layout classes.

Overview Improves mobile thread feed behavior when expanding turns, work groups, and tool rows: scroll position, live-follow, and list animations stay aligned instead of jumping or re-pinning the user to the bottom.

Live-follow adds a disclosure-settled path in resolveThreadFeedLiveFollow and runs it after disclosure layout settles so follow only re-arms when the list is actually at the end and the user is not in an active scroll session.

Disclosure UI introduces shared ThreadDisclosureChevron (animated rotation), tightens vertical margins and fixed-height constants (TURN_FOLD_HEIGHT, WORK_GROUP_TOGGLE_HEIGHT), and changes feed row animations: delayed FadeIn while disclosureToggleSettling replaces per-row entering-ID tracking and removes outer-row FadeOut on removal.

ThreadDetailScreen keys ThreadFeed with environment-scoped selectedThreadKey instead of bare thread id so disclosure/state does not leak across environment switches.

@legendapp/list patch (lockfile hash updated) extends scroll/inset handling: contentInsetStartAdjustment, getIsAtEnd when size changes without scroll events, ReanimatedSizeView for animated content height, MVCP/maintain-scroll guards during size animations and user drag/momentum, and related anchored-end-space and initial-scroll fixes used by the thread list.

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

Note

Fix thread scroll bounds after disclosure animations in LegendList and ThreadFeed

  • Patches @legendapp/list to compute isAtEnd accurately during size-only layouts, defer maintainScrollAtEnd during user scroll sessions, and keep animated content-size changes aligned with logical size changes.
  • Adds a disclosure-settled event to resolveThreadFeedLiveFollow so the follow latch re-arms only when the list is actually at the end and no user scroll session is active.
  • Simplifies ThreadFeed disclosure animations to fade-in only (no exit animation), and reconciles end-follow after two animation frames in settleDisclosureAfterLayout.
  • Introduces ThreadDisclosureChevron with Reanimated rotation, replacing static SymbolView icons in ThreadWorkLog and ThreadFeed; tightens vertical spacing on fold and toggle rows.
  • Changes ThreadDetailScreen's ThreadFeed remount key from selectedThread.id to selectedThreadKey.
  • Risk: the @legendapp/list patch touches core scroll-finishing and isAtEnd logic in patches/@legendapp__list@3.3.5.patch; regressions would affect all LegendList consumers, not just thread feeds.
Macroscope summarized ad27b1b.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.3 KiB13.4 KiB+153 B (+1.1%)15.1 KiB✅
      CodexThread snapshot wire6.9 KiB6.9 KiB−11 B (−0.2%)7.3 KiB✅
      CodexLive turn WebSocket wire6.4 KiB6.6 KiB+164 B (+2.5%)7.8 KiB✅
      CodexLive turn WebSocket decoded55.6 KiB57.0 KiB+1.4 KiB (+2.6%)66.4 KiB✅
      CodexLive turn messages10100 (0.0%)21✅
      ClaudeTotal thread wire13.3 KiB13.5 KiB+151 B (+1.1%)15.1 KiB✅
      ClaudeThread snapshot wire6.9 KiB6.9 KiB+6 B (+0.1%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.4 KiB6.6 KiB+145 B (+2.2%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded56.4 KiB57.8 KiB+1.4 KiB (+2.5%)66.4 KiB✅
      ClaudeLive turn messages10100 (0.0%)21✅

      Baseline: 0947c30 · PR result: ad27b1b · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 109.4 KiB
      • Claude decoded thread snapshot: 110.1 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

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

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR changes production mobile scrolling and animation behavior across the thread feed and patched LegendList/Reanimated runtime, including native bounds, initial positioning, and end-follow state. The scope is mobile-only, but the cross-layer and platform-dependent impact is substantial enough for human validation.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. github-actions[bot](GitHub profile, opens in a new tab) added labels📱 Native Change

    5. juliusmarminge merged this261380f

    6. juliusmarminge closed this

Sign in to join this conversation.