fix(web): stop chat jitter when opening citations at the bottom#1406
Draft
brendan-kellam wants to merge 2 commits into
Draft
fix(web): stop chat jitter when opening citations at the bottom#1406brendan-kellam wants to merge 2 commits into
brendan-kellam wants to merge 2 commits into
Conversation
When the chat is stuck to the bottom, selecting a citation triggers a scroll-into-view that fights useStickToBottom's auto-scroll, causing the view to jitter. Release the stick-to-bottom lock on citation selection so the reveal scroll can settle. Generated with [Linear](https://linear.app/sourcebot/issue/SOU-1486/chat-jitters-when-opening-citations-at-bottom#agent-session-fbed4bdc) Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Generated with [Linear](https://linear.app/sourcebot/issue/SOU-1486/chat-jitters-when-opening-citations-at-bottom#agent-session-fbed4bdc) Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
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.
Fixes SOU-1486
Clicking a citation while scrolled to the bottom of a chat caused the view to jitter vertically (repeatedly, on every click).
The chat scroll container uses
useStickToBottom. While the user is at (or within ~70px of) the bottom, the hook keeps the container anchored to the bottom and re-asserts that position whenever content resizes or scrolls. Selecting a citation kicks off ascrollIntoView(inchatThreadListItem.tsx) to reveal/center the reference, anduseStickToBottomfights that scroll by yanking back to the bottom. The two compete for the scroll position for a frame or two on each click, which is the jitter. It only reproduces "at the bottom" because that's the only state where the stick-to-bottom lock is engaged.Fix: release the stick-to-bottom lock (
stopScroll()) when a citation reference is selected, so the reveal scroll can settle without a fight. This is the same state the hook enters when the user scrolls up manually, and it matches the intent of the interaction (you're now inspecting a citation, not following streaming output). Sending a new message re-engages auto-scroll as before.