Skip to content

fix(desktop): scroll to bottom when switching to active session - #710

Open
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/issue-683-scroll-bottom-on-session-switch
Open

fix(desktop): scroll to bottom when switching to active session#710
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/issue-683-scroll-bottom-on-session-switch

Conversation

@Kailigithub

Copy link
Copy Markdown
Contributor

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 after refreshEmptyState(sess).

Change

One line, in frontends/desktop/static/app.js setActiveSession:

   renderAllMessages(sess);
+  scrollBottom(true);
   setBusy(sess, rt(sess).busy);

The existing scrollBottom(force=true) helper unconditionally schedules msgArea.scrollTop = msgArea.scrollHeight via requestAnimationFrame, 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.

$ node /tmp/test_issue_683.cjs
✓ setActiveSession calls scrollBottom(true) after renderAllMessages(sess)
✓ scrollBottom(force) helper defined as expected
✓ 3 scrollBottom(true) call sites total (1 new + prior)

ALL CHECKS PASSED

Verified via the standard git-stash three-step dance (stash -> test fails -> stash pop -> test passes).

Issue

Closes #683

Notes

  • 1-line diff, 1 file, no new code paths.
  • No new tests added to the repo: the project's CONTRIBUTING.md explicitly prefers minimal change radius, and this JS change runs in the desktop browser (no headless browser available in the cron env to exercise it end-to-end).
  • The behavioral test lives at /tmp/test_issue_683.cjs for reproducibility and can be re-run against any future regression of the same pattern.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][桌面] 切换到处理中会话时不会滚到最新输出

1 participant