diff --git a/dashboard/frontend/src/routes/Terminal.svelte b/dashboard/frontend/src/routes/Terminal.svelte index de75c1f..db3c6b8 100644 --- a/dashboard/frontend/src/routes/Terminal.svelte +++ b/dashboard/frontend/src/routes/Terminal.svelte @@ -267,7 +267,7 @@ async function connect(forceRefresh = false) { // Always refresh token before first connection to ensure fresh cookies - const d = tabData.get(tabId); + let d = tabData.get(tabId); const isFirstConnect = !d?.hasConnectedOnce; if (forceRefresh || isFirstConnect) { @@ -343,7 +343,7 @@ }; ws.onclose = async (e) => { const reason = e.reason || `Connection closed (code ${e.code})`; - const d = tabData.get(tabId); + d = tabData.get(tabId); if (d) d.ws = null; // Handle auth failures (code 1008) @@ -386,13 +386,13 @@ } }; ws.onerror = () => { - const d = tabData.get(tabId); + d = tabData.get(tabId); if (d) d.ws = null; if (!closedManually) scheduleReconnect("Connection failed"); else updateTab(tabId, { connected: false, error: "Connection failed" }); }; - const d = tabData.get(tabId); + d = tabData.get(tabId); if (d) { d.ws = ws; d.heartbeat = heartbeat;