This commit is contained in:
Tommy D. Rossi
2025-11-21 23:24:33 +01:00
parent 7ae0891ec3
commit ce0187f177
2 changed files with 8 additions and 5 deletions
+7 -4
View File
@@ -29,6 +29,9 @@ const useExtensionStore = create<ExtensionState>(() => ({
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<void> {
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
+1 -1
View File
@@ -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}`);
}
}