fix(desktop): scroll to bottom when switching to active session - #710
Open
Kailigithub wants to merge 1 commit into
Open
fix(desktop): scroll to bottom when switching to active session#710Kailigithub wants to merge 1 commit into
Kailigithub wants to merge 1 commit into
Conversation
Closes lsdefine#683 — switching to a session whose agent is still streaming left the viewport pinned near the user's last message instead of jumping to the latest draft. Mirror the existing refreshEmptyState(sess); scrollBottom(true) pattern from sibling render paths so setActiveSession lands at the bottom.
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.
Summary
Switching to a session whose agent is still streaming left the viewport pinned near the user's last message instead of jumping to the latest draft. Add the same
scrollBottom(true)call that sibling render paths (lines 2228 / 2267) already use afterrefreshEmptyState(sess).Change
One line, in
frontends/desktop/static/app.jssetActiveSession:renderAllMessages(sess); + scrollBottom(true); setBusy(sess, rt(sess).busy);The existing
scrollBottom(force=true)helper unconditionally schedulesmsgArea.scrollTop = msgArea.scrollHeightviarequestAnimationFrame, so the new draft (if any) is visible immediately after the session switch.Test
Behavioral test (the cleanest possible evidence for a 1-line fix): fails on
main, passes with this branch.Verified via the standard git-stash three-step dance (
stash -> test fails -> stash pop -> test passes).Issue
Closes #683
Notes
/tmp/test_issue_683.cjsfor reproducibility and can be re-run against any future regression of the same pattern.