From 465a34837d1d2c99aafbf21de1f92c47163b4174 Mon Sep 17 00:00:00 2001 From: Timo <6156589+Shik3i@users.noreply.github.com> Date: Wed, 22 Apr 2026 12:01:27 +0200 Subject: [PATCH] fix: only show 'ON' badge when connected to a room with a target tab --- extension/background.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extension/background.js b/extension/background.js index 30fd75e..d313830 100644 --- a/extension/background.js +++ b/extension/background.js @@ -259,7 +259,7 @@ function updateBadgeStatus() { } else if (status === 'connecting') { chrome.action.setBadgeText({ text: '...' }); chrome.action.setBadgeBackgroundColor({ color: '#fbbf24' }); - } else if (currentTabId) { + } else if (status === 'connected' && currentTabId) { chrome.action.setBadgeText({ text: 'ON' }); chrome.action.setBadgeBackgroundColor({ color: '#22c55e' }); } else { @@ -531,7 +531,9 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { } else if (message.type === 'LEAVE_ROOM') { emit(EVENTS.LEAVE_ROOM, { peerId }); currentRoom = null; + currentTabId = null; stopHeartbeat(); + updateBadgeStatus(); if (storageInitialized) chrome.storage.session.set({ currentRoom: null }); addLog('Left Room', 'info'); chrome.runtime.sendMessage({ type: 'PEER_UPDATE', peers: [] }).catch(() => {});