From 1f39df35dcfdf41de1a1761844bb32438478b10b Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Wed, 21 Oct 2026 03:43:16 -0700 Subject: [PATCH] fix(app): read a turn's reply only once the pointer rests on it --- packages/app/src/session/timeline/turn-navigator.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/app/src/session/timeline/turn-navigator.tsx b/packages/app/src/session/timeline/turn-navigator.tsx index 950b3a1cce3..f4bd5ff8f51 100644 --- a/packages/app/src/session/timeline/turn-navigator.tsx +++ b/packages/app/src/session/timeline/turn-navigator.tsx @@ -22,7 +22,11 @@ const indexLimit = 1000 // Messages read back from the next turn to find an unloaded turn's reply. One read also fills the replies of the // older turns it reaches, so their previews are ready before the pointer gets there. -const replyScanLimit = 40 +const replyScanLimit = 20 + +// The prompt previews at once; its reply waits for the pointer to rest, so a sweep across a long rail reads nothing. +// Rows can carry inline attachments, which makes each read costly in big sessions. +const replyHoverDelay = 150 // Each tick keeps at least this many pixels; a rail with more turns than fit shows an even sample of them. const tickMinPitch = 4 @@ -231,7 +235,8 @@ function TurnRail(props: TurnNavigatorProps & { index?: Map; roo const id = state.hover if (!id || loaded().has(id) || state.replies[id] !== undefined) return - void loadReply(id).catch(() => undefined) + const timer = setTimeout(() => void loadReply(id).catch(() => undefined), replyHoverDelay) + onCleanup(() => clearTimeout(timer)) }) const active = createSelector(activeMarks, (id: string, visible) => visible.has(id))