From 5f0a1894513e29734ac0571ee880989e257587b2 Mon Sep 17 00:00:00 2001 From: Timo <6156589+Shik3i@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:35:13 +0200 Subject: [PATCH] fix(popup): trigger CONNECT when popup opens with saved roomId MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If user has a room configured but the background is not connected (e.g. service worker was killed, startup race, or stale state), the popup now sends CONNECT on open. Previously it only called GET_STATUS and showed 'disconnected' with 0 logs — the user had no way to know whether the extension was working. --- extension/popup.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extension/popup.js b/extension/popup.js index 4f6a142..fcce5b4 100644 --- a/extension/popup.js +++ b/extension/popup.js @@ -255,6 +255,13 @@ async function init() { updatePeerList(res.peers); lastKnownPeers = res.peers || []; if (res.lastActionState) updateLastActionUI(res.lastActionState, res.peers); + + // If user has a room configured but background is not connected, + // trigger connection now — the popup opening is explicit user intent. + if (res.status === 'disconnected' && localData.roomId) { + chrome.runtime.sendMessage({ type: 'CONNECT' }).catch(() => {}); + applyConnectionStatus('connecting'); + } // Populate Tabs using the background's targetTabId await populateTabs(res.peers, res.targetTabId);