Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): recover timeline following and bottom navigation #15859

Closedbloom-street(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/15859/headopened View on GitHub

Showing 4 changed files with 79 additions and 2 deletions (loading 1).

x
0 of 4 viewed, 4 left
11 additions and 2 deletionsapps/web/src/components/chat/MessagesTimeline.tsxModified
View file
@@ -70,6 +70,7 @@
use,
useCallback,
useEffect,
+ useEffectEvent,
useLayoutEffect,
useMemo,
useRef,
@@ -1009,12 +1010,20 @@
}, []);
const reportContentOverflow = useCallback(() => {
- if (!onContentOverflowChange || contentOverflowFrameRef.current !== null) return;
+ if (contentOverflowFrameRef.current !== null) return;
contentOverflowFrameRef.current = requestAnimationFrame(() => {
contentOverflowFrameRef.current = null;
- onContentOverflowChange(measureContentOverflow());
+ onContentOverflowChange?.(measureContentOverflow());
+ reportTimelineEnd();
}, [measureContentOverflow, onContentOverflowChange]);
+ const reportTimelineEnd = useEffectEvent(() => {
+ if (restoringThreadPosition || citationPositioning) return;
+ const state = listRef.current?.getState();
+ if (state?.data !== rows) return;
+ const isAtEnd = resolveTimelineIsAtEnd(state);
+ if (isAtEnd !== undefined) onIsAtEndChange(isAtEnd);
+ });
useEffect(() => cancelContentOverflowFrame, [cancelContentOverflowFrame]);