From 8cecdfa4c285fcb2de54ebd876ee56d940e5a124 Mon Sep 17 00:00:00 2001 From: limiteinductive Date: Sun, 29 Mar 2026 20:32:50 +0200 Subject: [PATCH] fix: useRef needs initial value for strict TS Co-Authored-By: Claude Opus 4.6 (1M context) --- ui/colony/src/hooks/useChannelSocket.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/colony/src/hooks/useChannelSocket.ts b/ui/colony/src/hooks/useChannelSocket.ts index 6846f02..df61e8b 100644 --- a/ui/colony/src/hooks/useChannelSocket.ts +++ b/ui/colony/src/hooks/useChannelSocket.ts @@ -18,7 +18,7 @@ export function useChannelSocket( onMessage: (msg: Message) => void, ) { const wsRef = useRef(null); - const reconnectTimer = useRef>(); + const reconnectTimer = useRef | null>(null); const connect = useCallback(() => { if (!channelId) return; @@ -53,7 +53,7 @@ export function useChannelSocket( useEffect(() => { connect(); return () => { - clearTimeout(reconnectTimer.current); + if (reconnectTimer.current) clearTimeout(reconnectTimer.current); wsRef.current?.close(); wsRef.current = null; };