From 91aa76e842304c3f10f88cfdf224b335689064bb Mon Sep 17 00:00:00 2001 From: Timo <6156589+Shik3i@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:44:57 +0200 Subject: [PATCH] fix: revert premature isConnecting reset + remove popup disconnected flicker - background.js: remove isConnecting=false at line 608 (was set before WebSocket handshake completed, defeating the guard for the entire CONNECTING phase). isConnecting is already properly reset in onclose, onopen/40 handler, catch block, and socket guard path. - background.js: restore isConnecting=false in forceDisconnect() so subsequent connect() calls can proceed after intentional disconnect. - popup.js: remove hardcoded applyConnectionStatus('disconnected') that caused a guaranteed red flicker on every popup open. Status is now set only by the async GET_STATUS response. --- extension/background.js | 3 +-- extension/popup.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/extension/background.js b/extension/background.js index 9eb8320..9f44a08 100644 --- a/extension/background.js +++ b/extension/background.js @@ -343,6 +343,7 @@ function forceDisconnect() { socket = null; } currentServerUrl = null; + isConnecting = false; isNamespaceJoined = false; isForceSyncInitiator = false; expectedAcksCount = 0; @@ -605,8 +606,6 @@ async function connect() { addLog('WebSocket Error: Connection failed', logType); }; - isConnecting = false; - } catch (e) { isConnecting = false; const logType = reconnectAttempts > 1 ? 'error' : 'warn'; diff --git a/extension/popup.js b/extension/popup.js index fcce5b4..4c39bc9 100644 --- a/extension/popup.js +++ b/extension/popup.js @@ -237,8 +237,7 @@ async function init() { refreshLogs(); refreshHistory(); - // Default connection status (localized) before async check - applyConnectionStatus('disconnected'); + // Initial Status Check (status shows via GET_STATUS below) // Initial Status Check chrome.runtime.sendMessage({ type: 'GET_STATUS' }, async (res) => {