Scrolling a long thread stutters after loading earlier turns (timeline measure pass and per-scroll message re-derivation)

未关闭
#39,545 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
react, typescript

调研方向

Start by locating useTimelineFollow and the legend-list measure pass identified in the CPU trace (W$ in the generated bundle); the issue gives no source file paths, so search the repository for those entry points. Profile scrolling after repeatedly loading earlier turns and inspect the layout effects and row derivation they trigger. Done means the long-thread scroll no longer repeatedly measures every mounted container or rebuilds unchanged message rows, with the initial-page behavior preserved.

由索引模型根据 Issue 内容生成。

描述

via-triage

What happened

Scrolling the chat timeline of a long thread (about 3,250 items, 318 turns) stutters on the Windows desktop app. The jank appears after "Load earlier turns" has been used. At the initial page the same thread scrolls smoothly.

Diagnosis

Repro in the web client served by the thread's own server, headless Chromium at 1600x1000, with a scripted 8 s rAF scroll sweep on .messages-timeline-scroll:

State Scroll height DOM nodes p50 p99 Max frame Frames >50 ms
Initial page 3,812 px 2,053 16.7 ms 17.2 ms 67 ms 1
After 8x "Load earlier turns" ~197,000 px ~3,000 16.7 ms 83 ms 200 ms 9

The DOM stays near 3,000 nodes because the list is virtualized, so the cost scales with the amount of loaded history rather than with the DOM.

The CPU trace for the loaded state (8 s of scrolling) shows:

  • 14,980 forced style and layout flushes totalling 1.13 s, plus 640 ms of self time in getBoundingClientRect. All of it comes from the legend-list measure pass (r0 -> W$ in main-*.js), which runs from layout effects during commits and measures every mounted container. In W$, getBoundingClientRect is followed by offsetWidth/offsetHeight and sometimes getComputedStyle.
  • Scroll-time work in useTimelineFollow-*.js that rebuilds message rows: formatMessage takes 218 ms, encode about 116 ms, and lt/Q/yt in session-logic run under Lp/gh/Dh. This re-derivation runs while scrolling, even though the thread is idle and nothing new is arriving.
  • Long Animation Frame attribution names DOMWebSocket.onmessage as the entry point for most long frames (2.45 s), because the runtime picks up work queued behind socket messages. The handler itself takes under 20 ms; the cost is the rendering work above.

Rendering itself is small: about 300 ms in the render phase and 190 ms in paint.

Caveat: headless Chromium rasterizes in software, so absolute frame times are higher than in the desktop app. The layout and JS costs above are CPU-side and carry over.

Steps to reproduce

  1. Open a thread with a few thousand timeline items.
  2. Click "Load earlier turns" until a few hundred thousand px of history is loaded.
  3. Scroll up and down with the wheel or trackpad.

Version

Desktop app 0.1.11-nightly.20261119.4954 (Windows). The thread lives on a linked Linux environment that runs 0.1.11-nightly.20261119.4941, and the headless repro used that server's web client.

Environment

Windows 11 Pro 26300, Ryzen 7 5800X, 128 GB RAM, RTX 3080 Ti, 60 Hz. The machine was idle during the repro (no process above about one core of 16, GPU 3D under 4%).

Evidence

Local scroll traces, LoAF summaries and the CPU trace are available on request.

Workaround

Switch away from the thread and back; it reopens at the first page, which scrolls smoothly.

Related

  • #13925: the same symptom on the Android app, which has a separate native feed. That report says web and desktop are smooth, which no longer holds once older turns are loaded.
  • #12689: Windows desktop renderer stalls from synchronous topology IPC. This repro ran in a browser with no desktopBridge, so that path is excluded here and may add to it on desktop. This desktop's desktop.trace.ndjson shows 4,111 sendSync calls in 8.3 h, with handlers at a 1.6 ms maximum.
  • #37639: a forced layout from equations when a thread opens; a different trigger.
  • #22350: iOS LegendList scrollBy corrections; this one is about scroll position, not CPU.

Agent: Claude Code (Opus 5.5), following the t3 triage playbook.

主要语言
TypeScript
星标
24.8k
派生
6.4k
平均合并
4 小时 29 分钟
30 天内合并 PR
488

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pingdotgg/t3code 的其他 Issue

查看 pingdotgg/t3code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。