Conversation
… Virtuoso dual scroll context
Contributor
|
Hi @samzong, DetailsInstructions for interacting with me using comments are available here. |
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.
Summary
ChatView had two scroll architecture flaws: (1)
scrollToBottomfired on every streaming token viauseEffectonactiveTurn?.streamingText, causing synchronousscrollTop = scrollHeightforced reflow ~30 times/second; (2) Virtuoso nested insideoverflow-y-autocreated competing scroll contexts, withStreamingMessagerendered outside Virtuoso's scroll ownership.Type of change
[Fix]bug fixWhy is this needed?
Per-token forced reflow causes visible jank on mobile during streaming. The dual scroll context means streaming content may be clipped or unreachable when virtualization is active (≥100 messages).
What changed?
scrollToBottomcallback +useEffectdepending onactiveTurn?.streamingTextwith a singleResizeObserveron a content wrapper div — zero coupling to React data flow, fires at most once per frameChatTailcomponent whose prop shape{ context?: TailContext }directly matches Virtuoso's Footer APIoverflow-y-auto+scrollRef+contentRefwrapper observed by ResizeObserveroverflow-hidden, no scrollRef; tail content rendered via Virtuosocomponents.FootersofollowOutputaccounts for streaming height changesVIRTUOSO_COMPONENTSdefined at module level for stable component identity (prevents unmount/remount per render)Architecture impact
docs/architecture-invariants.md: noneLinked issues
Closes #
Validation
pnpm lintpnpm testpnpm check:ui-contractpnpm check(full suite: lint + architecture + ui-contract + renderer-copy + i18n + dead-code + format + typecheck + test)Commands, screenshots, or notes:
Screenshots or recordings
No visual change. Scroll behavior is functionally identical — the fix eliminates forced reflow during streaming and resolves scroll context conflicts in virtualized mode.
Release note
NONE.Checklist
[Feat],[Fix],[UI],[Docs],[Refactor],[Build], or[Chore]