fix(chat): stop dragging the viewport back to bottom while streaming (#811) - #843
Open
lifelmy wants to merge 1 commit into
Open
fix(chat): stop dragging the viewport back to bottom while streaming (#811)#843lifelmy wants to merge 1 commit into
lifelmy wants to merge 1 commit into
Conversation
Once the user scrolls up during a streaming turn, auto-follow now stays suspended until they return to the bottom, so streaming deltas no longer pull the viewport back down mid-read. Snap-to-bottom is gated on a follow-bottom flag maintained from real scroll events; the decision logic is extracted into pure helpers with regression coverage. Fixes org2AI#811 Co-authored-by: TRAE CLI <traecli@bytedance.com>
Neonforge98
marked this pull request as ready for review
August 20, 2026 05:08
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
While a turn is streaming output, scrolling up to read earlier content was repeatedly dragged back to the bottom (#811). The message viewport snapped to the bottom on every streaming delta regardless of where the user had scrolled, so any upward scroll was undone on the next chunk.
This change makes auto-follow stateful: once the user scrolls up, following is suspended and stays suspended until they return to the bottom (or the container returns to the bottom on its own). Streaming deltas then leave the reading position stable.
Changes
MessageViewer.tsx: track afollowBottomflag from real scroll events; the snap-to-bottom effect now only runs while following (or already at the bottom). View/replay-window identity changes re-arm following so a fresh view starts pinned to the newest content, preserving the existing default behavior.MessageViewer/autoFollow.ts: new pure helpers (isViewportAtBottom,resolveAutoFollowOnScroll) that own the decision, so it is testable without a DOM/render environment.__tests__/autoFollow.test.ts: regression coverage proving an upward scroll suspends follow, repeated streaming growth keeps it suspended, returning to the bottom re-arms it, and a partial downward scroll does not re-arm.Test plan
pnpm exec vitest run src/modules/WorkStation/Chat/Communication— 97 passed (10 files), including the 9 new auto-follow tests.pnpm exec eslinton the changed files — clean.pnpm run typecheck(tsc --noEmit) — 0 errors.I have reviewed the design and implementation.
Fixes #811