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:
parent
baabae0594
commit
795e1248aa
1 changed files with 4 additions and 9 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue