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 && (