Skip to content

fix(web-ui): stabilize flow chat viewport anchoring - #1821

Merged
wsp1911 merged 1 commit into
GCWing:mainfrom
wsp1911:dev2
Jul 28, 2026
Merged

fix(web-ui): stabilize flow chat viewport anchoring#1821
wsp1911 merged 1 commit into
GCWing:mainfrom
wsp1911:dev2

Conversation

@wsp1911

@wsp1911 wsp1911 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a semantic viewport coordinator for pinned items, tail following, and preserved elements.
  • Keep footer reservations synchronized with the DOM while streaming content grows or tool cards collapse.
  • Extend the shared tool-card height contract so all participating cards can preserve their header position during automatic and manual collapse.
  • Improve sticky-pin settlement, late-clamp recovery, virtualizer compensation handling, and pinned-to-tail handoff.
  • Add focused regression coverage and document the resulting scroll stability model.

Fixes #1578

Type and Areas

Type:

Regression fix

Areas:

Web UI, Flow Chat, virtualized message list, tool cards

Motivation / Impact

New user messages could briefly lose their pinned position or permanently fall away from the top while assistant output was streaming. Automatic tool-card collapse could also move the card header because Virtuoso, footer compensation, and follow-output behavior independently adjusted the viewport.

This change gives viewport ownership to a semantic coordinator and makes bottom-range reservation part of the list's internal behavior. New turns remain pinned until they can safely transition to tail-follow mode, while collapsing tool cards retain a stable header position without requiring card-specific offset calculations.

Verification

  • pnpm run type-check:web — passed
  • pnpm --dir src/web-ui run test:run src/flow_chat/components/modern/VirtualMessageList.session-boundary.test.tsx src/flow_chat/components/modern/FlowChatViewportCoordinator.test.ts src/flow_chat/tool-cards/useToolCardHeightContract.test.tsx src/flow_chat/tool-cards/TodoWriteDisplay.test.tsx — 4 files and 38 tests passed
  • git diff --check — passed
  • Repeated manual streaming checks covered simple responses, file-editing tasks, TodoWrite, Write, automatic collapse, turn start, and turn completion.

Reviewer Notes

The main review surface is the ownership boundary between semantic anchors, Virtuoso scroll compensation, footer reservations, and streaming tail-follow behavior.

Tool cards use a generic collapse contract; the virtualized list does not contain tool-name-specific handling. Temporary diagnostic instrumentation and debug logs are not included.

No user-facing strings, locale resources, or external contracts were changed.

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.

- centralize pinned-item, tail-follow, and preserved-element behavior in a semantic viewport coordinator
- synchronize footer reservations with streaming growth and tool-card collapse transactions
- preserve tool-card header positions through the shared height contract
- handle virtualizer compensation, late scroll clamping, and pinned-to-tail handoff
- add focused regression tests and update scroll stability documentation
@wsp1911
wsp1911 marked this pull request as ready for review July 28, 2026 08:27
@wsp1911
wsp1911 merged commit 57098b3 into GCWing:main Jul 28, 2026
7 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.

[Bug]: 流式输出过程内容闪烁

1 participant