From 945053c20a61d4c6510c00f34ee89af51632e6d2 Mon Sep 17 00:00:00 2001 From: Jack Kingsman Date: Sun, 15 Feb 2026 23:49:50 -0800 Subject: [PATCH] Add turbo resend for testing --- frontend/src/components/MessageList.tsx | 29 ++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/MessageList.tsx b/frontend/src/components/MessageList.tsx index 6978545..2580953 100644 --- a/frontend/src/components/MessageList.tsx +++ b/frontend/src/components/MessageList.tsx @@ -159,6 +159,7 @@ export function MessageList({ } | null>(null); const [resendableIds, setResendableIds] = useState>(new Set()); const resendTimersRef = useRef>>(new Map()); + const activeBurstsRef = useRef[]>>(new Map()); // Capture scroll state in the scroll handler BEFORE any state updates const scrollStateRef = useRef({ @@ -259,6 +260,17 @@ export function MessageList({ }; }, [messages, onResendChannelMessage]); + // Clean up burst timers on unmount + useEffect(() => { + const bursts = activeBurstsRef.current; + return () => { + for (const timers of bursts.values()) { + for (const t of timers) clearTimeout(t); + } + bursts.clear(); + }; + }, []); + // Handle scroll - capture state and detect when user is near top/bottom const handleScroll = useCallback(() => { if (!listRef.current) return; @@ -511,7 +523,22 @@ export function MessageList({ className="text-muted-foreground hover:text-primary ml-1 text-xs cursor-pointer" onClick={(e) => { e.stopPropagation(); - onResendChannelMessage(msg.id); + if (e.altKey) { + // Burst resend: 5 times, 2 seconds apart + if (activeBurstsRef.current.has(msg.id)) return; + onResendChannelMessage(msg.id); // first send (immediate) + 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); + timers.push(timer); + } + activeBurstsRef.current.set(msg.id, timers); + } else { + onResendChannelMessage(msg.id); + } }} title="Resend message" >