fix: scroll to bottom when loading existing conversations#7614
Merged
fix: scroll to bottom when loading existing conversations#7614
Conversation
When loading an old conversation, the chat now scrolls all the way to the bottom instead of positioning an anchor message at the top. This behavior is consistent regardless of the autoScroll setting.
Add h-full to MessageList wrapper so it stretches vertically and remove spacer div inline height to avoid extra gap that clipped the blur. Co-authored-by: PR #7598
Remove spacerHeight state, calcSpacerHeight function, and all related code since the spacer div no longer has a height and serves no purpose.
Contributor
Greptile SummaryThis PR improves scroll behavior when loading existing conversations by making them scroll to the bottom instead of positioning at an anchor element. It also removes approximately 60 lines of dead code related to spacer height calculations that became unused after removing the spacer div. Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ChatPage
participant ChatScrollContainer
participant MessageList
Note over User,MessageList: Loading Existing Conversation
User->>ChatPage: Open existing conversation
ChatPage->>ChatScrollContainer: Render with anchorSelector, sessionId
ChatScrollContainer->>ChatScrollContainer: Detect isLoadingExistingContent=true
ChatScrollContainer->>ChatScrollContainer: Calculate targetScrollTop = scrollHeight - clientHeight
ChatScrollContainer->>ChatScrollContainer: scrollTo(bottom, "instant")
ChatScrollContainer->>ChatScrollContainer: Set isAtBottomRef = true
ChatScrollContainer->>MessageList: Render messages with h-full
MessageList-->>ChatScrollContainer: Content rendered
ChatScrollContainer->>User: Display conversation at bottom
Note over User,MessageList: New Message Streaming (autoScroll=true)
User->>ChatPage: Send new message
ChatPage->>MessageList: Stream new content
MessageList->>ChatScrollContainer: MutationObserver detects change
ChatScrollContainer->>ChatScrollContainer: Check wasAtBottom && autoScroll
ChatScrollContainer->>ChatScrollContainer: scrollToBottom("instant")
ChatScrollContainer->>User: Auto-scroll to new content
Note over User,MessageList: Anchor Change During Active Session
User->>ChatPage: Navigate to different message
ChatPage->>ChatScrollContainer: Update anchorSelector (isLoadingExistingContent=false)
ChatScrollContainer->>ChatScrollContainer: Calculate targetScrollTop = anchor.offsetTop
ChatScrollContainer->>ChatScrollContainer: scrollTo(anchor, "smooth")
ChatScrollContainer->>User: Smooth scroll to anchor position
|
jmelahman
approved these changes
Jan 21, 2026
Contributor
jmelahman
left a comment
There was a problem hiding this comment.
diff looking like the NASDAQ 😍
nmgarza5
added a commit
that referenced
this pull request
Jan 27, 2026
nmgarza5
added a commit
that referenced
this pull request
Jan 27, 2026
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.
Description
Updates ChatScrollContainer scroll behavior when loading existing conversations:
autoScrollsettingh-fullto MessageList wrapper so it fills the container verticallyspacerHeightstate,calcSpacerHeightfunction) that became unused after the spacer div no longer has a heightHow Has This Been Tested?
2026-01-20.18.56.45.mp4
Additional Options