fix(desktop): follow streaming output when user is at bottom (#2159)#2235
Merged
esengine merged 1 commit intoMay 29, 2026
Merged
Conversation
…e#2159) The scroll-follow useEffect had no dependency array, so it ran on every render but did not check atBottomRef — meaning it would try to re-pin even when the user had scrolled up to read earlier content, and conversely the missing dep array caused React to skip the effect in some batched renders during fast streaming. Add a guard on atBottomRef.current and a proper [messageItems] dependency so the effect only fires when new messages arrive and only scrolls when the user is already pinned to the bottom.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Author
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
esengine
approved these changes
May 29, 2026
esengine
left a comment
Owner
There was a problem hiding this comment.
Correct fix for #2159. The auto-scroll effect now guards on atBottomRef.current (don't re-pin to bottom when the user has scrolled up to read history) with a re-check inside the rAF, and gains a [messageItems] dep so it stops firing on every render. Follows streaming output when the user is at the bottom, leaves them alone when they're not. Small and right, CI green. Merging.
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.
问题
关闭 #2159。桌面版流式输出时不自动滚动到底部。
根因
useEffect没有依赖数组(每次渲染都执行),但没有检查atBottomRef.current:问题:
atBottomRef.current→ 用户向上滚动查看历史时也会被强制拉回底部修复
添加
[messageItems]依赖数组 +atBottomRef.current检查:只有新消息到来且用户在底部时才滚动。