Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): land the first thread open above the composer on Android #5585

MergedPollyGlot(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/5585/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Summary

On Android (and pre-glass iOS), the very first open of a thread whose messages are not yet in the client cache can rest with its last lines hidden behind the composer text field. Once the thread has been opened before (messages cached), the same open lands correctly, which is why this mostly bites right after a cold app launch.

Root cause: on the non-automatic-inset path the composer overlay only exists as the keyboard integration's animated bottom padding, which LegendList's scroll math cannot see. The screen compensated with an imperative reportContentInset on the empty→filled remount, but that call races the list's one-shot initial scroll-to-end; when it loses, the initial position is computed with a zero end inset and rests exactly one composer-height low.

Fix: declare the estimated composer overlay height through the existing contentInsetEndStaticAdjustment prop (the same channel iOS already uses for UIKit's safe-area overcount), so the scroll math knows about the overlay from construction. The racy imperative report becomes redundant and is removed. Net: 9 insertions, 15 deletions, one file.

Before / After

First open of an uncached long thread, right after a cold launch (left: last lines and timestamp rest behind the composer; right: they land above it):

BeforeAfter
beforeafter

Test plan

  • Reproduced on a Pixel emulator (API 35): cold launch → first open of an uncached long thread rests one composer-height low; reopening the same thread (cached) lands correctly.
  • With the fix: first open lands above the composer, including cold launch and a deliberately slowed server (HTTP snapshot timeout → socket fallback path).
  • No double inset: resting gap between the last message and the composer is unchanged (the static adjustment only feeds scroll math on native; the visual spacer exists only on web).
  • Keyboard behavior intact: focusing the composer keeps the thread end anchored above the expanded composer; closing it restores the resting position.
  • tsc --noEmit, vp lint, vp fmt clean.

Related: #5582 fixes the separate issue that Android renders no backdrop gradient, so text scrolling behind the composer stayed fully legible. The two are independent.

🤖 Generated with Claude Code


Note

Low Risk Scoped to Android thread feed scroll/inset behavior with unit tests; iOS path explicitly unchanged to avoid native double-inset.

Overview Fixes Android thread feeds where the first open (especially uncached / cold launch) could scroll to the end with the last messages hidden behind the composer, because LegendList’s end-inset math ran before the keyboard integration reported overlay height.

Adds deriveThreadFeedInitialContentInset in layout.ts and wires it in ThreadFeed: on Android (when not using iOS-style automatic insets), passes a declarative contentInset.bottom equal to the estimated composer / bottom overlay height so initial scrollAtEnd uses that floor immediately. The prop is omitted on iOS so UIKit is not double-inset. Comments clarify that the existing remount reportContentInset still syncs measured height after empty→filled transitions, while the declarative inset covers the race on Android.

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

Note

Fix first thread opening above the composer on Android

On Android, the first thread in a feed was rendering behind the composer overlay because LegendList had no bottom content inset to account for it. Adds deriveThreadFeedInitialContentInset in layout.ts to compute a bottom inset equal to the estimated composer height on Android (when native automatic insets are not used), and passes it as contentInset to LegendList in ThreadFeed.tsx. On iOS with native automatic insets, the prop is omitted.

Macroscope summarized 8fe2ade.
    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: 10d7bcef-f0d5-4d07-b7eb-02c966710f19

      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:unvouched

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

      Approvability

      Verdict: Approved 88e38bd

      Self-contained Android-specific bug fix for thread scroll positioning with clear logic, unit tests, and platform guards. The author has recent history with this code area, and the open review comment has been substantively addressed.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9ed20ff1f13309da84c58f75e915935fd539d637. Configure [here](https://www.cursor.com/dashboard/bugbot).

Sign in to join this conversation.