fix(ui): stabilize chat scrolling - #3820
Merged
Merged
Conversation
Virtualize complete conversation turns so Markdown height measurements do not shift individual messages into view. Generated-By: PostHog Code Task-Id: f1cb8dcf-8a50-4e12-afbf-19a697d4e63d
|
😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details. |
|
React Doctor found 2 issues in 2 files · 2 warnings. 2 warnings
Reviewed by React Doctor for commit |
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/ui/src/features/sessions/components/VirtualizedList.tsx:252-254
**Touch movement breaks bottom-follow**
When a user moves their finger downward or sideways while the conversation is at the bottom, this handler clears `isAtBottomRef` without checking direction, causing a concurrent streamed-content or row-height update to skip `scrollToEnd` and leave new content below the viewport.
Reviews (1): Last reviewed commit: "fix(ui): stabilize chat scrolling" | Re-trigger Greptile |
Contributor
|
✅ Visual changes approved by @richardsolomou — baseline updated in 10 changed. |
Leave the experimental chat rendering unchanged until it has a bounded solution for long threads. Generated-By: PostHog Code Task-Id: f1cb8dcf-8a50-4e12-afbf-19a697d4e63d
Preserve item search anchors, distinguish touch direction, and share conversation turn boundaries across both thread groupers. Generated-By: PostHog Code Task-Id: f1cb8dcf-8a50-4e12-afbf-19a697d4e63d
10 updated Run: 1222e7ad-9d74-4457-9327-6b32e657dabd Co-authored-by: richardsolomou <2622273+richardsolomou@users.noreply.github.com>
Generated-By: PostHog Code Task-Id: f1cb8dcf-8a50-4e12-afbf-19a697d4e63d
Generated-By: PostHog Code Task-Id: f1cb8dcf-8a50-4e12-afbf-19a697d4e63d
Generated-By: PostHog Code Task-Id: f1cb8dcf-8a50-4e12-afbf-19a697d4e63d
adamleithp
approved these changes
Jul 26, 2026
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.
Problem
Long legacy chat threads jitter and push the reader back down while scrolling upward. Markdown and tool rows mount with estimated heights, then their real measurements change individual virtual rows above the viewport.
Virtualized chat state can also survive a
taskIdchange, causing a newly opened task to inherit the previous thread's scroll position.Changes
I changed the legacy view to virtualize complete conversation turns with stable keys. Each prompt and response is measured and cached as one unit, while bottom-follow disengages as soon as an upward wheel or touch gesture begins.
Item-level DOM anchors remain inside each turn so conversation search can still highlight matches. Both thread implementations share the same user-initiated turn boundary, and the stateful chat renderer is keyed by
taskIdso switching tasks resets its virtualization and scroll state.There is no visual design change, so screenshots are N/A.
How did you test this?
@posthog/uitypecheck, Biome, and the repository commit hooks.taskIdremount.Automatic notifications
Created with PostHog Code