From fb38fee965a6385962a34bf840ec611551b2b10c Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Fri, 15 May 2026 12:30:20 +0200 Subject: [PATCH] fix(chat): lower pagination skeleton delay threshold to 50ms --- packages/web/src/components/chat/MessageList.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/web/src/components/chat/MessageList.tsx b/packages/web/src/components/chat/MessageList.tsx index 97875e0e..9cac835f 100644 --- a/packages/web/src/components/chat/MessageList.tsx +++ b/packages/web/src/components/chat/MessageList.tsx @@ -99,7 +99,13 @@ export function MessageList({ channelId, jumpToMessageId, onJumpComplete }: Mess const SMOOTH_SCROLL_DEADLINE_MS = 800; const [isLoadingMore, setIsLoadingMore] = useState(false); const showInitialSkeleton = useDelayedLoading(isLoading && messages.length === 0); - const showPaginationSkeleton = useDelayedLoading(isLoadingMore); + // 50 ms threshold (vs the 200 ms default on showInitialSkeleton above) is + // safe here because Task 2's constant-height slot eliminated the layout + // shift the 200 ms originally hid. 50 ms is below the ~100 ms visual + // perception threshold so near-instant cache hits still complete without + // ever rendering the skeleton, while slow loads see the skeleton appear + // before the user's eye can register the slot as empty. + const showPaginationSkeleton = useDelayedLoading(isLoadingMore, { threshold: 50 }); const prevMessagesLength = useRef(0); const prevChannelIdRef = useRef(channelId); const visibleMsgIdRef = useRef(null);