From ce0187f177561f221a70bf7c62339d9b4c699e08 Mon Sep 17 00:00:00 2001 From: "Tommy D. Rossi" Date: Fri, 21 Nov 2025 23:24:33 +0100 Subject: [PATCH] nn --- extension/src/background.ts | 11 +++++++---- extension/src/relayConnection.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/extension/src/background.ts b/extension/src/background.ts index fefbe32..64b47cd 100644 --- a/extension/src/background.ts +++ b/extension/src/background.ts @@ -29,6 +29,9 @@ const useExtensionStore = create(() => ({ errorText: undefined, })) +// @ts-ignore +globalThis.state = useExtensionStore + async function resetDebugger() { let targets = await chrome.debugger.getTargets() targets = targets.filter((x) => x.tabId && x.attached) @@ -102,7 +105,7 @@ useExtensionStore.subscribe(async (state, prevState) => { for (const tabId of allTabIds) { const tabInfo = tabId !== undefined ? connectedTabs.get(tabId) : undefined - + const iconConfig = (() => { if (connectionState === 'error') { return icons.error @@ -121,7 +124,7 @@ useExtensionStore.subscribe(async (state, prevState) => { } return icons.disconnected })() - + const title = (() => { if (connectionState === 'error' && errorText) { return errorText @@ -131,7 +134,7 @@ useExtensionStore.subscribe(async (state, prevState) => { } return iconConfig.title })() - + void chrome.action.setIcon({ tabId, path: iconConfig.path }) void chrome.action.setTitle({ tabId, title }) if (iconConfig.badgeColor) void chrome.action.setBadgeBackgroundColor({ tabId, color: iconConfig.badgeColor }) @@ -291,7 +294,7 @@ async function connectTab(tabId: number): Promise { state: 'error', errorText: `Error: ${error.message}`, }) - + // If we were trying to establish a connection and failed, reset the global state // so we don't get stuck in 'reconnecting' which triggers destructive click behavior let nextConnectionState = state.connectionState diff --git a/extension/src/relayConnection.ts b/extension/src/relayConnection.ts index 968cdb5..d52161f 100644 --- a/extension/src/relayConnection.ts +++ b/extension/src/relayConnection.ts @@ -328,7 +328,7 @@ export class RelayConnection { } if (!targetTab) { - throw new Error(`No tab found for sessionId: ${sessionId}`); + throw new Error(`No tab found for method ${method} sessionId: ${sessionId}`); } }