Skip to content

fix(chat): stop dragging the viewport back to bottom while streaming (#811) - #843

Open
lifelmy wants to merge 1 commit into
org2AI:developfrom
lifelmy:agent-tasks/811
Open

fix(chat): stop dragging the viewport back to bottom while streaming (#811)#843
lifelmy wants to merge 1 commit into
org2AI:developfrom
lifelmy:agent-tasks/811

Conversation

@lifelmy

@lifelmy lifelmy commented Aug 19, 2026

Copy link
Copy Markdown

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 a followBottom flag 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 eslint on the changed files — clean.
  • pnpm run typecheck (tsc --noEmit) — 0 errors.

I have reviewed the design and implementation.

Fixes #811

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
Neonforge98 marked this pull request as ready for review August 20, 2026 05:08
@Neonforge98
Neonforge98 requested a review from Harry19081 August 20, 2026 05:09
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.

Scroll position repeatedly dragged back to bottom while a turn is streaming output

1 participant