fix timeline scroll

This commit is contained in:
7w1 committed 2026-03-20 00:22:05 -05:00
1 parent 4af4339863
commit 987c81241f
1 file changed
+6 -14
+6 -14
View File
@@ -214,20 +214,12 @@ export function RoomTimeline({
const processedEventsRef = useRef<ProcessedEvent[]>([]);
const timelineSyncRef = useRef<typeof timelineSync>(null as unknown as typeof timelineSync);
const scrollToBottom = useCallback(
(behavior?: 'instant' | 'smooth') => {
if (!vListRef.current) return;
const lastIndex = processedEventsRef.current.length - 1;
if (lastIndex < 0) return;
if (behavior === 'smooth' && !reducedMotion) {
vListRef.current.scrollToIndex(lastIndex, { align: 'end', smooth: true });
} else {
vListRef.current.scrollTo(vListRef.current.scrollSize);
}
},
[reducedMotion]
);
const scrollToBottom = useCallback(() => {
if (!vListRef.current) return;
const lastIndex = processedEventsRef.current.length - 1;
if (lastIndex < 0) return;
vListRef.current.scrollTo(vListRef.current.scrollSize);
}, []);
const timelineSync = useTimelineSync({
room,