Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-timeline-pagination-spinner-layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Properly centered message loading indicators to avoid brief scrollbar shift while loading messages.
41 changes: 28 additions & 13 deletions src/app/features/room/RoomTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -720,12 +720,6 @@ export function RoomTimeline({
</Chip>
</Box>
);
} else if (timelineSync.backwardStatus === 'loading' && timelineSync.eventsLength > 0) {
backPaginationJSX = (
<Box justifyContent="Center" style={{ padding: config.space.S300 }}>
<Spinner variant="Secondary" size="400" />
</Box>
);
}
}

Expand All @@ -752,15 +746,20 @@ export function RoomTimeline({
</Chip>
</Box>
);
} else if (timelineSync.forwardStatus === 'loading' && timelineSync.eventsLength > 0) {
frontPaginationJSX = (
<Box justifyContent="Center" style={{ padding: config.space.S300 }}>
<Spinner variant="Secondary" size="400" />
</Box>
);
}
}

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')
Expand Down Expand Up @@ -1009,7 +1008,23 @@ export function RoomTimeline({
</VList>
</div>

{frontPaginationJSX}
{showBackPaginationSpinner && (
<TimelineFloat position="Top" style={timelineTopFloatLift}>
<Spinner variant="Secondary" size="400" />
</TimelineFloat>
)}

{showFrontPaginationSpinner && (
<TimelineFloat position="Bottom" style={timelineBottomFloatLift}>
<Spinner variant="Secondary" size="400" />
</TimelineFloat>
)}

{frontPaginationJSX && (
<TimelineFloat position="Bottom" style={timelineBottomFloatLift}>
{frontPaginationJSX}
</TimelineFloat>
)}

{!atBottomState && isReady && (
<TimelineFloat position="Bottom">
Expand Down
Loading