mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-05 17:07:43 +00:00
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:
@@ -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
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user