diff --git a/.changeset/fix-timeline-pagination-spinner-layout.md b/.changeset/fix-timeline-pagination-spinner-layout.md new file mode 100644 index 000000000..81d0e72cb --- /dev/null +++ b/.changeset/fix-timeline-pagination-spinner-layout.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +Properly centered message loading indicators to avoid brief scrollbar shift while loading messages. diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index 92f82061b..56bf1cca5 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -720,12 +720,6 @@ export function RoomTimeline({ ); - } else if (timelineSync.backwardStatus === 'loading' && timelineSync.eventsLength > 0) { - backPaginationJSX = ( - - - - ); } } @@ -752,15 +746,20 @@ export function RoomTimeline({ ); - } else if (timelineSync.forwardStatus === 'loading' && timelineSync.eventsLength > 0) { - frontPaginationJSX = ( - - - - ); } } + const showBackPaginationSpinner = + timelineSync.backwardStatus === 'loading' && timelineSync.eventsLength > 0; + const showFrontPaginationSpinner = + timelineSync.forwardStatus === 'loading' && timelineSync.eventsLength > 0; + const timelineBottomFloatLift = + !atBottomState && isReady ? { bottom: `calc(${config.space.S400} + ${toRem(52)})` } : undefined; + const timelineTopFloatLift = + unreadInfo?.readUptoEventId && !unreadInfo?.inLiveTimeline && isReady + ? { top: `calc(${config.space.S400} + ${toRem(52)})` } + : undefined; + const vListItemCount = timelineSync.eventsLength === 0 && (!isReady || timelineSync.canPaginateBack || timelineSync.backwardStatus === 'loading') @@ -1009,7 +1008,23 @@ export function RoomTimeline({ - {frontPaginationJSX} + {showBackPaginationSpinner && ( + + + + )} + + {showFrontPaginationSpinner && ( + + + + )} + + {frontPaginationJSX && ( + + {frontPaginationJSX} + + )} {!atBottomState && isReady && (