From 1685b6a32747ddc915db1ec6d2b7592b3e7e8d33 Mon Sep 17 00:00:00 2001 From: Timo <6156589+Shik3i@users.noreply.github.com> Date: Mon, 15 Jun 2026 14:19:18 +0200 Subject: [PATCH] fix(popup): join timeout checks connection status instead of blind 15s timer Lazy-connect introduces a new state where the user clicks 'Raum erstellen' and the WebSocket takes 1-2s to establish (previously always pre-connected). The old 15s blind timeout would re-enable the button while background was still connecting, causing silent no-op clicks. Now polls GET_STATUS and extends the window if still connecting. --- extension/popup.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/extension/popup.js b/extension/popup.js index baa6013..3a76b5d 100644 --- a/extension/popup.js +++ b/extension/popup.js @@ -1195,11 +1195,23 @@ elements.joinBtn.addEventListener('click', async () => { if (joinBtnTimeout) clearTimeout(joinBtnTimeout); joinBtnTimeout = setTimeout(() => { - elements.joinBtn.disabled = false; - elements.joinBtn.textContent = getMessage('BTN_JOIN_ROOM'); - joinBtnTimeout = null; - isProcessingConnection = false; - showError(getMessage('ERR_CONN_TIMEOUT')); + chrome.runtime.sendMessage({ type: 'GET_STATUS' }, (res) => { + if (res && res.status === 'connecting') { + joinBtnTimeout = setTimeout(() => { + elements.joinBtn.disabled = false; + elements.joinBtn.textContent = getMessage('BTN_JOIN_ROOM'); + joinBtnTimeout = null; + isProcessingConnection = false; + showError(getMessage('ERR_CONN_TIMEOUT')); + }, 15000); + return; + } + elements.joinBtn.disabled = false; + elements.joinBtn.textContent = getMessage('BTN_JOIN_ROOM'); + joinBtnTimeout = null; + isProcessingConnection = false; + if (res && res.status !== 'connected') showError(getMessage('ERR_CONN_TIMEOUT')); + }); }, 15000); const serverUrl = elements.serverUrl.value.trim();