diff --git a/apps/desktop/src/pages/ConversationPage.tsx b/apps/desktop/src/pages/ConversationPage.tsx index b3c151b..4598d94 100644 --- a/apps/desktop/src/pages/ConversationPage.tsx +++ b/apps/desktop/src/pages/ConversationPage.tsx @@ -304,7 +304,6 @@ export function ConversationPage() { const fileInputRef = useRef(null); const composerRef = useRef(null); - useEffect(() => { if (firstUnreadComputedRef.current) return; if (!id || messages.length === 0) return; @@ -719,7 +718,12 @@ export function ConversationPage() { // now, so we have to call it explicitly. Tracked via a ref so we only // scroll when the count actually grew (not on every render where it // happens to be > 0). - const lastPendingCountRef = useRef(0); + // Initialize from the current pending count rather than 0 so we don't + // fire scrollToIndex(LAST) on the very first render of a chat that + // already has outbox-queued items. Only growth of `pending.length` + // across renders should trigger the snap-to-bottom (i.e., the user + // just submitted something new). + const lastPendingCountRef = useRef(pending.length); useEffect(() => { if (pending.length > lastPendingCountRef.current) { virtuosoRef.current?.scrollToIndex({