feat(FN-4336): complete Step 1 — add direct-chat resize observer anchor follower

Fusion-Task-Id: FN-4336
Fusion-Task-Lineage: d96c9da9-e355-4dc0-bf8c-451a917b0270
This commit is contained in:
Fusion
2026-05-13 09:25:25 -07:00
committed by gsxdsm
parent 9a43652e83
commit 35f1d6117b

View File

@@ -1352,6 +1352,33 @@ export function ChatView({ projectId, addToast, experimentalFeatures }: ChatView
};
}, [isMobile, activeSession, roomThreadActive, anchorToBottom]);
useEffect(() => {
if (roomThreadActive) {
return;
}
if (typeof ResizeObserver === "undefined") {
return;
}
const messagesContainer = messagesContainerRef.current;
if (!messagesContainer) {
return;
}
const observer = new ResizeObserver(() => {
if (isUserScrollingRef.current) {
return;
}
anchorToBottom(messagesContainer);
});
observer.observe(messagesContainer);
return () => {
observer.disconnect();
};
}, [roomThreadActive, anchorToBottom, activeSession?.id, chatScope]);
// Fetch agents on mount for name resolution (project-scoped with stale-request protection)
useEffect(() => {
let cancelled = false;