fix(site/src/pages/AgentsPage): suppress sticky prompt updates during streaming#26076
Open
tracyjohnsonux wants to merge 1 commit into
Open
fix(site/src/pages/AgentsPage): suppress sticky prompt updates during streaming#26076tracyjohnsonux wants to merge 1 commit into
tracyjohnsonux wants to merge 1 commit into
Conversation
… streaming The pinned sticky user prompt would bounce or overlap with the transcript while the agent was actively streaming. The content ResizeObserver fired on every streamed token, re-running the sticky update() and shifting the pinned bubble against ongoing layout changes. Track the latest hasActiveStream value via a ref and skip the resize update path while it is true. When streaming ends, run a single catch-up update so the pinned bubble settles at its correct height after the suppressed updates. > Generated by Coder Agents on behalf of @tracyjohnsonux
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.
Split out from #25324, which originally combined the prompt history popover with stability fixes for the sticky pinned user prompt. This PR contains only the streaming-related overlap fix.
Problem
While the agent is actively streaming, the pinned sticky user prompt would bounce and visually overlap the streaming transcript. The content
ResizeObserveron the chat scroller fires on every streamed token, which re-runs the stickyupdate()against ongoing layout changes from the agent output.This was most obvious on mobile, where every touch (or the device's own momentum scrolling) triggered scroll events while streaming was already shifting layout, so the pinned prompt visibly fought the user's scroll position. Reported by @mattvollmer.
Fix
Track the latest
hasActiveStreamvalue onStickyUserMessagevia a ref so theResizeObserver(created once in a[]effect) can read it without recreating the observer. Skip the resize-driven update path while streaming is active. When streaming ends, run a single catch-upupdate()so the pinned bubble settles at its correct height after the suppressed updates.Scope
Intentionally narrow:
StickyUserMessagegains ahasActiveStreamprop, threaded fromConversationTimeline.hasActiveStreamRefmirrors that value into the persistent observer.ResizeObserverearly-returns whilehasActiveStreamRef.currentis true.useLayoutEffectkeyed onhasActiveStreamruns one trailingupdateFnRef.current?.()on the streaming-to-idle transition.make lint/emdash.The prompt history popover, scroll-lock helper, and
data-user-message-idsentinel attribute remain in #25324.