Repository navigation
fix(chat): 折叠工具操作时下方消息不再闪动 - #1129
Merged
AlphaCatMeow merged 1 commit intoNov 3, 2026
Merged
Conversation
桌面端聊天列表把 ResizeObserver 的结算推迟到下一帧(为 macOS WKWebView 加的 useAnimationFrameWithResizeObserver),结算时用的是上一帧记下的行高。 工具组、工具卡、"已处理"的折叠动画每帧都在改行高,下面的行因此总晚一帧, 折叠时两行之间露出最大约 40px 的空白,看上去在闪。 - 推迟结算改为读行的实时布局高度(offsetHeight,不受祖先 transform 影响); ref 回调路径仍返回缓存值,不额外读布局 - 写入时机不变,仍在 rAF 里,不在 WebKit 的 resize 回调里写 DOM - WebUI 的列表在 ResizeObserver 回调里同步结算,没有这个问题,未改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
桌面端折叠工具组、工具卡、"已处理"时,下方消息会闪。原因是聊天列表把 ResizeObserver 的结算推迟到下一帧(
useAnimationFrameWithResizeObserver,为 macOS WKWebView 加的),结算用的是上一帧记下的行高。折叠动画每帧都在改行高,下面的行总晚一帧,两行之间每帧露出空白,最大约 40px。Closes #1128
改动
offsetHeight,与 RO 的 border box 同为布局尺寸,不受祖先 transform 影响)。新模块crates/agent-gui/src/pages/chat/transcript/measureRowLive.ts,在TranscriptList里设为measureElement。TranscriptList开了推迟结算。WebUI 的GatewayTranscript在 RO 回调里同步结算,没有这个问题,未改;Gateway 同步无数据契约变化。截图
桌面 1280(调试版,工具组展开 / 折叠后):
WebUI 1280 折叠后 / 390 展开:
闪烁本身是帧间现象,截图看不出,逐帧数据见下。
验证
upstream/mainb7a902atauri dev,MCP bridge,在每帧绘制后读 DOM;行间空隙 = 下一行顶 − 本行底):transcript-measure-live.test.mjs:用真实 virtual-core(crates/virtual-core/test/helpers/harness.mjs)加推迟 RO:折叠帧空隙为 0,默认测量器复现 20px 空隙;ref 回调路径不读布局;贴底非批处理路径的强制布局次数与默认一致。chat-transcript-scroller.test.mjs:接线断言(选项启用且未被注释)。check-mirror通过;git diff --check通过。la-full-tests8 个批次全部运行,4492 项,通过 4488,失败 3,跳过 1。3 条均为已知环境失败:crates/agent-gui下重跑 13/13 通过。未覆盖
transcriptMeasurementsLru里升级前存下的测量值与offsetHeight可能差 1px,首次 RO 交付时每行校正一次。🤖 Generated with Claude Code