fix: auto-scroll to bottom after sending a message in chat (#6815)

This commit is contained in:
Marius
2026-03-10 14:06:21 +01:00
committed by GitHub
parent ab7cc73d51
commit dcee6dd9b7
@@ -885,6 +885,11 @@ export const SessionProvider: ParentComponent = (props) => {
}
setStore("messages", sid, (msgs = []) => [...msgs, temp])
setStore("parts", tempId, [{ type: "text" as const, id: `${tempId}-text`, text }])
// The optimistic message is now in the DOM but the session status is
// still "idle" (the CLI backend hasn't started yet), so the auto-scroll
// ResizeObserver won't scroll on its own. Force scroll to bottom so the
// user's own message is immediately visible.
queueMicrotask(() => window.dispatchEvent(new CustomEvent("resumeAutoScroll")))
}
const agent = selectedAgentName() !== defaultAgent() ? selectedAgentName() : undefined