Skip to content
Source
Sign inSign up
pingdotgg/t3code

Android: tapping a chat in the thread list waits ~350 ms on the JS thread before the screen opens #40941

Openzakius(GitHub profile, opens in a new tab) opened this issue 0 comments

What happened

On Android, opening a chat from the home thread list feels unresponsive. Nothing happens on screen for about a third of a second after the finger lifts. Then the push animation plays, and the chat is often still blank for a moment. The back arrow, the bottom tab bar, Search and the Settings pages feel fine. The user describes it as "it waits 300 ms longer after the tap than tap vs hold vs double tap requires".

Diagnosis

The delay is JS work that runs before the native-stack transition can start. It is not gesture arbitration or the network.

  • A fixed cost on every open. After a tap on a chat row, the JS thread (mqt_v_js) is about 100% busy for roughly 500–700 ms. A 6-message chat costs about the same as a 705-message chat.
  • The new-thread draft screen costs the same. Its first 0.7 s also takes 690–720 ms of JS, and it has no messages. So most of the cost is in what the Thread route and the new-thread draft route share: the detail screen scaffolding and the composer.
  • Other pushes are cheap. Search costs 50–90 ms and Settings → General / Appearance costs 120–210 ms. The app idles at 1–7% JS.
  • Feed work comes on top. Larger chats keep the JS thread busy for another 0.4–1.3 s after the transition. Meanwhile ThreadFeed keeps the list at opacity: 0 while settling (~3854 / ~4390, with a 1000 ms fallback), which is the blank period.
  • No feedback during the wait. RowPressable shows its overlay only on hover, so a finger press gets no highlight.

Forcing the app locale to en-US (the device is pl-PL, which falls back to en) did not change the cost meaningfully: 510–620 ms against 510–710 ms.

Nothing was profiled. The release build is not profileable. The fix hints below come from reading the source at dd941b9c, ranked by likely impact:

  1. Intl polyfill work in gt() / ICU formatting. Open PR #40602 profiled this as the dominant JS cost of thread opens on another Android device. The detail screen and the composer call gt()/m() many times on mount, so this fits a cost that is the same for every chat. Landing #40602, and #40603 for markdown, is probably the biggest single win.
  2. Mount the heavy detail body after the transition. ThreadScreenHost.tsx:64-71 publishes props from a useLayoutEffect with no dependency array into a useSyncExternalStore outlet. Both ThreadRouteScreen and NewTaskDraftScreen use it. This forces a second synchronous render of ThreadDetailScreen + ThreadComposer inside the tap's task. The app already has a pattern for deferring until transitionEnd: usePullRequestDiffEntry in features/pull-requests/usePullRequestDiff.ts:71-109. Rendering a light shell first, or publishing through startTransition, would let the slide start right away.
  3. Composer derivations on every render. ThreadComposer.tsx:418 / :602 call buildModelOptions, which is O(providers × models), and serverConfigForCwd(...) likely returns a fresh object, which defeats React Compiler memoization. Caching by serverConfig identity would avoid both.
  4. A screen flag that may not be needed on Android. index.ts:16 turns on synchronousScreenUpdatesEnabled globally, and its comment says it is for iOS FormSheet sizing. Gate it to iOS and re-measure on Android.
  5. First open per session. AdaptiveWorkspaceLayout.tsx:575 sets setFileInspectorPreferredVisible(false) when the initial value is true. This re-renders the home list in the same batch.
  6. Feed. Seed estimatedListSize from the window dimensions, because viewportHeight starts at 0 on phones (~3216 / ~4435). Also consider building the feed after the transition.

Steps to reproduce

  1. On an Android phone, open the T3 Code app on the Chats tab.
  2. Tap any chat row, even one with a handful of messages.
  3. Nothing moves for about 350 ms after release. Then the push starts, and the feed is often blank for a further 0.1–1 s.
  4. Compare with Search, a Settings page, the back arrow or the bottom tabs. All of them react quickly.

Version

Android app 2.3.0 (versionCode 809), production package com.t3tools.t3code. Server 0.1.12-nightly.20261121.5051.

Environment

ASUS Zenfone 10 (ASUS_AI2302), Android 15, system locale pl-PL. The connection to the server ran over T3 Connect. System animator scale 0.5, transition scale 0.

Evidence

Screen recordings with Android's pointer-location overlay, timed from finger release to the first screen change. The taps were 110 ms presses injected with adb shell input swipe, some with an 8 px drift. Drift made no difference.

InteractionResponse after release
Chat row (4 runs)353, 334, 352, 403 ms
Back arrow in chat (4 runs)117, 118, 151, 101 ms
Bottom tabs (4 runs)152, 84, 166, 117 ms

JS-thread CPU (mqt_v_js, from /proc/<pid>/task/<tid>/stat) in the first 0.7 s after a tap:

Screen openedJS busy
Chat, 6 messages570–720 ms
Chat, 198 messages580–710 ms
Chat, 705 messages680–710 ms
New-thread draft690–720 ms
Search50–90 ms
Settings → General120–140 ms
Settings → Appearance200–210 ms
Idle on home list10–75 ms per 1 s

Over 40 s of normal use, dumpsys gfxinfo reported 493 frames: p50 8 ms, p90 21 ms, p99 38 ms, and "Number High input latency: 650".

  • #40602 (open PR): memoizes Intl polyfills during thread opens. Its profile matches these symptoms, and this report is independent evidence for it from a second Android device.
  • #40603 (open PR): caches markdown parses.
  • #24192 and #38646 (closed): server-side causes of slow opens. Not this.

Fix applied or workaround

None on the client. The server was healthy when these measurements were taken.

Filed by

Claude Opus 5.5 (claude-opus-5-5) in Claude Code, via T3 Code triage.

  1. zakius(GitHub profile, opens in a new tab) added labelsvia-triage

  2. tanstack-source added labelsbug

Sign in to join this conversation.