Skip to content

fix(flowchat): stabilize history scrolling and smooth navigation - #3636

Merged
GCWing merged 1 commit into
mainfrom
gcwing/flowchat-history-scroll-smoothness
Oct 31, 2026
Merged

GCWing merged 1 commit into
mainfrom
gcwing/flowchat-history-scroll-smoothness

Conversation

@GCWing

@GCWing GCWing commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 在手动滚动的布局提交中批量测量新挂载行,减少估算高度与真实布局不一致引起的反向跳动;程序定位继续使用虚拟器的测量策略,避免平滑动画中途变为瞬间跳转。
  • 将视口实际补偿位移记入锚点,防止重复修正;同一次原生 scroll 事件共享几何采样,减少重复 DOM 读取。
  • 会话阅读位置按稳定行 key 和当前测量位置恢复,覆盖旧绝对位置失效、长回答内部偏移超出新估算高度的情况。
  • 增加单元回归测试、隔离的原生历史滚动 E2E fixture,并更新所属文档。

Type and Areas

Type: Bug fix / performance / regression fix / tests / docs

Areas: Web UI FlowChat viewport、virtualization、session restoration;Desktop E2E fixtures。

Motivation / Impact

长历史滚动时,新行的实际高度会先改变内容布局,延后的测量及锚点重复补偿可能造成视口反向移动。会话重新挂载后的高度缓存也可能让原绝对 scrollTop 指向另一轮对话。本改动保持阅读位置并减少滚动处理中的重复读取。

强制测量只补足普通滚动路径;显式定位保留虚拟器的测量策略。用户接管时先取消定位,首个滚动提交仍会立即测量新行。

Verification

  • 以下聚焦测试:16 files / 261 tests passed,包括先复现失败、修复后通过的平滑定位与用户接管回归测试:
pnpm --dir src/web-ui run test:run src/flow_chat/components/modern/useFlowChatVirtualizer src/flow_chat/components/modern/useFlowChatViewportAnchor.test.tsx src/flow_chat/components/modern/flowChatViewportAnchor.test.ts src/flow_chat/components/modern/useFlowChatLeadingExtent.test.tsx src/flow_chat/components/modern/useFlowChatFollowOutput src/flow_chat/components/modern/useFlowChatViewportOwner.test.tsx src/flow_chat/components/modern/VirtualMessageList.session-boundary.test.tsx src/flow_chat/components/modern/flowChatHistoryPager.test.ts src/flow_chat/components/modern/flowChatHistoryBoundary.test.ts
  • pnpm run type-check:web — passed。
  • pnpm --dir src/web-ui run lint — 0 errors;其他文件中有 16 条 warnings。
  • pnpm run motion:audit — 已完成;这是意图清单,不是性能或视觉验收。
  • git diff --cached --check — passed。
  • node scripts/check-git-object-sizes.mjs --base origin/main --head HEAD — passed。

Reviewer Notes

  • AI-assisted: Codex;验证范围为聚焦自动化测试与静态检查。
  • 测试使用真实虚拟器与提供的 DOM 几何数据,不代表原生 WebView 绘制或物理触控板体验。按仓库要求,本轮未运行 UI 交互验证;新增原生 E2E fixture 未在最终补丁上重新执行。文档中的原生性能数字为此前样本。
  • Remote workspace、Remote control、Peer Device Mode、Detached Dispatch 均未实测。未改变后端协议或持久化形状。
  • 提交前已刷新并检查 main;开放 PR 检查未找到覆盖同一实现和场景的修复。

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@GCWing
GCWing merged commit c088343 into main Oct 31, 2026
12 checks passed
@GCWing
GCWing deleted the gcwing/flowchat-history-scroll-smoothness branch November 6, 2026 06:35
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