From 0f606cc99138e9320b4c743401815868b9bc8da4 Mon Sep 17 00:00:00 2001 From: Dorian Date: Mon, 9 Mar 2026 08:39:36 +0000 Subject: [PATCH] fix: close existing SSE before opening new one (BUG-11) Prevents duplicate SSE connections when connectSSE is called without prior disconnect. Co-Authored-By: Claude Opus 4.6 --- frontend/src/composables/useFightPolling.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/composables/useFightPolling.ts b/frontend/src/composables/useFightPolling.ts index 49934d0..6fd1076 100644 --- a/frontend/src/composables/useFightPolling.ts +++ b/frontend/src/composables/useFightPolling.ts @@ -102,6 +102,8 @@ export function useFightPolling(fightId: Ref) { onHumanChallenge?: (data: any) => void onReaction?: (data: any) => void }) { + // Close any existing SSE connection before opening a new one + disconnectSSE() eventSource = new EventSource(`/api/fights/${fightId.value}/stream`) addSSEListener(eventSource, 'spectator_count', (e) => {