From c9809967e5865e87126dd38eecdd14b4097a823e Mon Sep 17 00:00:00 2001 From: "Tommy D. Rossi" Date: Fri, 27 Feb 2026 09:04:43 +0100 Subject: [PATCH] fix: hide tab group when relay dies instead of keeping it green MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit syncTabGroup was including 'connecting' tabs in the group unconditionally, so when the relay WebSocket closed and all tabs transitioned to 'connecting', the group stayed green. Now 'connecting' tabs are only included when the relay is actually connected (connectionState === 'connected'). When the relay is dead, 'connecting' tabs are excluded and the group gets cleaned up. The onUpdated handler at line ~1601 already guards against the ungroup→disconnect loop for 'connecting' tabs, so this is safe. --- extension/src/background.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/extension/src/background.ts b/extension/src/background.ts index b1bfac2..f8428ec 100644 --- a/extension/src/background.ts +++ b/extension/src/background.ts @@ -710,11 +710,15 @@ export function sendMessage(message: any): void { async function syncTabGroup(): Promise { try { - // Tabs in 'connected' or 'connecting' state belong in the group. - // Including 'connecting' prevents a loop where syncTabGroup removes a tab the user - // just dragged in (still connecting), which triggers onUpdated → disconnect → reconnect. + // Include 'connecting' tabs in the group only when the relay is alive, so that + // tabs the user drags into the group stay visible while attaching. When the relay + // is dead all tabs are 'connecting' (waiting for reconnect) and the group should + // be cleaned up. The onUpdated handler (line ~1601) already guards against the + // ungroup→disconnect loop for 'connecting' tabs, so excluding them here is safe. + const { connectionState } = store.getState() + const isRelayConnected = connectionState === 'connected' const connectedTabIds = Array.from(store.getState().tabs.entries()) - .filter(([_, info]) => info.state === 'connected' || info.state === 'connecting') + .filter(([_, info]) => info.state === 'connected' || (info.state === 'connecting' && isRelayConnected)) .map(([tabId]) => tabId) // Always query by title - no cached ID that can go stale