From 1aafc13b95c30d9d95d1e500309f1d59390aeae4 Mon Sep 17 00:00:00 2001 From: Wes Date: Wed, 17 Jun 2026 10:32:54 -0700 Subject: [PATCH] fix(desktop): paint thread replies on open without scroll nudge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Opening a thread panel rendered an empty reply list until the user scrolled a pixel, after which the replies popped into view. The reply list is gated behind `useDeferredValue` (#1022): the first frame after open has an empty deferred snapshot while the live list already holds the replies. `useTimelineScrollManager` was called with a hardcoded `isLoading: false`, so its init effect ran scroll-to-bottom on that empty frame and marked itself initialized. When the real replies committed a frame later they only got the fragile "new latest message" autoscroll path, which loses the timing race — the rows mounted at scrollTop 0 and stayed unpainted until a manual scroll. The main timeline avoids this because it passes a real `isLoading` and its init effect waits until content is ready. Give the thread panel the same gate: treat it as loading while the deferred reply list hasn't committed yet (`repliesRenderState === "pending"`). Init scroll then fires on the frame the replies actually commit. Genuinely-empty threads still init immediately. Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co> Signed-off-by: Wes --- desktop/src/features/messages/ui/MessageThreadPanel.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop/src/features/messages/ui/MessageThreadPanel.tsx b/desktop/src/features/messages/ui/MessageThreadPanel.tsx index 11002b2c85..fba4748ec3 100644 --- a/desktop/src/features/messages/ui/MessageThreadPanel.tsx +++ b/desktop/src/features/messages/ui/MessageThreadPanel.tsx @@ -368,7 +368,8 @@ export function MessageThreadPanel({ syncScrollState, } = useTimelineScrollManager({ channelId: threadHeadId, - isLoading: false, + // Wait for deferred replies to commit before scroll-init (else rows mount un-scrolled). + isLoading: repliesRenderState === "pending", messages: threadMessages, onTargetReached: onScrollTargetResolved, scrollContainerRef: threadBodyRef,