From afb71b77cc995bac068242d2a9fbf831da9c36dd Mon Sep 17 00:00:00 2001 From: 7w1 Date: Thu, 19 Mar 2026 18:06:12 -0500 Subject: [PATCH] almost flawless --- src/app/features/room/RoomTimeline.tsx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index 8c170d59..9e9e1b32 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -274,15 +274,7 @@ export function RoomTimeline({ if (!v) return; const prev = topSpacerHeightRef.current; - if (eventsLengthRef.current > 15) { - if (prev > 0) { - topSpacerHeightRef.current = 0; - setTopSpacerHeight(0); - } - return; - } - - const newH = Math.max(0, v.viewportSize + prev - v.scrollSize); + const newH = Math.max(0, v.viewportSize - v.scrollSize + prev); if (Math.abs(prev - newH) > 2) { topSpacerHeightRef.current = newH; setTopSpacerHeight(newH); @@ -612,6 +604,18 @@ export function RoomTimeline({ hideMemberInReadOnly, }); + useEffect(() => { + const v = vListRef.current; + if (!v) return; + if ( + canPaginateBackRef.current && + backwardStatusRef.current === 'idle' && + v.scrollSize <= v.viewportSize + ) { + timelineSyncRef.current.handleTimelinePagination(true); + } + }, [timelineSync.eventsLength, timelineSync.backwardStatus]); + return ( {unreadInfo?.readUptoEventId && !unreadInfo?.inLiveTimeline && (