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.
This commit is contained in:
Timo
2026-06-16 10:44:57 +02:00
parent 5f0a189451
commit 91aa76e842
2 changed files with 2 additions and 4 deletions
+1 -2
View File
@@ -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';
+1 -2
View File
@@ -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) => {