From 0d03945b81818373c1f8ca36e41c8165bdc8dee3 Mon Sep 17 00:00:00 2001 From: Jack Kingsman Date: Mon, 16 Feb 2026 00:37:27 -0800 Subject: [PATCH] Fix turbo resend --- frontend/src/components/MessageList.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/MessageList.tsx b/frontend/src/components/MessageList.tsx index 2580953..a8f7b9e 100644 --- a/frontend/src/components/MessageList.tsx +++ b/frontend/src/components/MessageList.tsx @@ -160,6 +160,8 @@ export function MessageList({ const [resendableIds, setResendableIds] = useState>(new Set()); const resendTimersRef = useRef>>(new Map()); const activeBurstsRef = useRef[]>>(new Map()); + const onResendRef = useRef(onResendChannelMessage); + onResendRef.current = onResendChannelMessage; // Capture scroll state in the scroll handler BEFORE any state updates const scrollStateRef = useRef({ @@ -527,15 +529,16 @@ export function MessageList({ // Burst resend: 5 times, 2 seconds apart if (activeBurstsRef.current.has(msg.id)) return; onResendChannelMessage(msg.id); // first send (immediate) + const msgId = msg.id; const timers: ReturnType[] = []; for (let i = 1; i <= 4; i++) { const timer = setTimeout(() => { - onResendChannelMessage(msg.id); - if (i === 4) activeBurstsRef.current.delete(msg.id); - }, i * 2000); + onResendRef.current?.(msgId); + if (i === 4) activeBurstsRef.current.delete(msgId); + }, i * 3000); timers.push(timer); } - activeBurstsRef.current.set(msg.id, timers); + activeBurstsRef.current.set(msgId, timers); } else { onResendChannelMessage(msg.id); }