scroll down to latest msg when switching chats#1733
Open
iyernaveenr wants to merge 1 commit into
Open
Conversation
02ba523 to
28f3dd1
Compare
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.
Problem
Switching to a different project in the sidebar leaves the chat scrolled to the top instead of showing the latest message at the bottom.
Root cause
In
ProjectChatContainer, the auto-scroll effect only fires when a new user message is appended (the message count increases and the last message is from the user). The other scroll effects only handle explicit sidebar navigation. Nothing scrolls the viewport when the active project changes, so a switch renders the newly selected project's messages but keeps the previous scroll position (the top).Fix
Add an effect keyed on the active project id that scrolls the chat container to the bottom after a short defer (so the newly rendered messages have laid out). It uses instant scrolling so switching does not visibly scroll through the whole history, and it does not affect in-conversation scrolling or the existing "scroll to bottom on new user message" behavior.
Testing
Switch between projects in the left sidebar - each now opens at the latest message (bottom) instead of the top.