fix: replace ResizeObserver with useEffect for auto-scroll in LeadThoughtsGroup

ResizeObserver stops firing once scroll container reaches maxHeight,
breaking auto-scroll for long-running live thought groups. Use useEffect
on chronologicalThoughts dependency instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iliya 2026-03-06 17:24:52 +02:00
parent baabae0594
commit 795e1248aa

View file

@ -258,17 +258,12 @@ export const LeadThoughtsGroupRow = ({
return () => observer.disconnect();
}, [onVisible, thoughts]);
// Auto-scroll via ResizeObserver — fires after CSS animations expand content
// Auto-scroll when new thoughts arrive
useEffect(() => {
const el = scrollRef.current;
if (!el) return;
const observer = new ResizeObserver(() => {
if (isUserScrolledUpRef.current) return;
el.scrollTop = el.scrollHeight;
});
observer.observe(el);
return () => observer.disconnect();
}, []);
if (!el || isUserScrolledUpRef.current) return;
el.scrollTop = el.scrollHeight;
}, [chronologicalThoughts]);
const handleScroll = useCallback(() => {
const el = scrollRef.current;