Skip to content

fix: 1.6.2 切换标签页后对话内容叠在一起 - #14

Merged
OpenX123 merged 2 commits into
mainfrom
fix/tab-switch-stacking
Nov 24, 2026
Merged

OpenX123 merged 2 commits into
mainfrom
fix/tab-switch-stacking

Conversation

@OpenX123

Copy link
Copy Markdown
Owner

背景

用户反馈:切换 workbench 标签页后,对话内容大量叠在一起;内容少时不明显,长会话、正在对话时明显。前两次(jsdom、合成回放 E2E)未能复现,本次用用户真实数据的隔离副本在 dev 版中复现。

Bugfix

  • 触发场景:长会话(单行高 940–2510px)所在标签页从隐藏切回可见,且切回时恢复滚动位置。
  • 根因证据:ConversationTimeline.tsx 会话切换 useLayoutEffect 依赖 paused(= !paneVisible),每次标签页重新可见都清空行高缓存并 virtualizer.measure(),所有行回落到 72px 估算;恢复滚动触发 scroll,@tanstack/react-virtual 3.13.23 在 isScrolling 期间不测新挂载行,只能等 ResizeObserver 异步回调。逐帧数据:切回首帧第 0–5 行 translateY 为 0/72/144/…/360,真实高度 940–2510px,最大重叠 1290px,持续约 450ms。把清缓存恢复为每次都清做 A/B,72px 叠行立即复现。
  • 修复:行高缓存只在会话坐标系(scrollMemoryKey、sessionKey)变化时清空;面板隐藏再显示保留真实测高(隐藏时测到的 0 本就不写入缓存)。
  • 回归:v4ConversationTimelineScrollMemory.test.ts 新增用例:隐藏再显示后 estimateSize 仍返回真实测高、切会话后回到 72;去掉修复时失败(expected 72 to be 1362)。

修复前后(真实数据,6 个长会话:原生 4、Claude Code 1、Codex 1)

场景 修复前 修复后
快速切换 1/36 0/36
切换时伴随 scroll 2/12 0/12
逐帧追踪必现会话 2/2 0
中部滚动后切换 — 0/12
隐藏期间改宽度后切回 — 0/10
流式输出期间切换 — 行重叠 0/22

验证

  • pnpm typecheck 通过;pnpm lint 0 errors;architecture:check --changed 0 违规;时间线相关 6 个测试文件 28 例通过。
  • 未验证:macOS 实机;隐藏期间窗口宽度变化时缓存高度为旧宽度值,需等 ResizeObserver 校正(10 次测试未见重叠)。

🤖 Generated with Claude Code

OpenX123 and others added 2 commits November 23, 2026 23:58
…le again

The session-switch layout effect also ran on every paused -> visible toggle and
cleared the turn height cache before virtualizer.measure(). Rows mounted while
the restored scroll was in flight skip tanstack's ref measurement
(isScrolling), so long turns painted at the 72px estimate spacing and overlapped
until the async ResizeObserver re-render landed. Only clear the cache when the
session scope (scrollMemoryKey + sessionKey) changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OpenX123
OpenX123 merged commit 5451558 into main Nov 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant