diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ecd8041314d..6668bee5efc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,8 +25,8 @@ catalogs: specifier: 0.3.6 version: 0.3.6 '@comfyorg/comfyui-desktop-bridge-types': - specifier: 0.4.0 - version: 0.4.0 + specifier: 0.5.0 + version: 0.5.0 '@comfyorg/comfyui-electron-types': specifier: 0.6.2 version: 0.6.2 @@ -520,7 +520,7 @@ importers: version: 0.3.6 '@comfyorg/comfyui-desktop-bridge-types': specifier: 'catalog:' - version: 0.4.0 + version: 0.5.0 '@comfyorg/comfyui-electron-types': specifier: 'catalog:' version: 0.6.2 @@ -2003,8 +2003,8 @@ packages: '@comfyorg/comfy-multi-player@0.3.6': resolution: {integrity: sha512-6mC4E43YH+58gV4I+tmUR4pIYxqUeiY8ShS1WjjDEYxsBKGbzU1rRNGZHKgrzP3cOKGzK/JSP663/SIN50kfeQ==} - '@comfyorg/comfyui-desktop-bridge-types@0.4.0': - resolution: {integrity: sha512-o692svyRg63dLisVcpEJRzIUK2m/T538eYZhoXFF2e+RBCScU4MHLk9FutZyjW+DCQxv0hGunBOs96Qffs+UcQ==} + '@comfyorg/comfyui-desktop-bridge-types@0.5.0': + resolution: {integrity: sha512-IlLhbbNaDwTw1JjE+7Z2OlejrE4zcfzORJdaF3mtkzSjCFdK+j8Nuf9XYX78S3vz+uqmxXtn35gDR4amHv7shw==} '@comfyorg/comfyui-electron-types@0.6.2': resolution: {integrity: sha512-r3By5Wbizq8jagUrhtcym79HYUTinsvoBnYkFFWbUmrURBWIaC0HduFVkRkI1PNdI76piW+JSOJJnw00YCVXeg==} @@ -10659,7 +10659,7 @@ snapshots: dependencies: yjs: 13.6.32 - '@comfyorg/comfyui-desktop-bridge-types@0.4.0': {} + '@comfyorg/comfyui-desktop-bridge-types@0.5.0': {} '@comfyorg/comfyui-electron-types@0.6.2': {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e5781f1b802..5f522002397 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -16,7 +16,7 @@ catalog: '@astrojs/mdx': ^7.0.5 '@astrojs/sitemap': ^3.7.3 '@astrojs/vue': ^7.0.2 - '@comfyorg/comfyui-desktop-bridge-types': 0.4.0 + '@comfyorg/comfyui-desktop-bridge-types': 0.5.0 '@comfyorg/comfyui-electron-types': 0.6.2 '@comfyorg/sdk': 0.2.0 '@customerio/cdp-analytics-browser': ^0.5.3 @@ -209,7 +209,7 @@ overrides: # Transitional - drop each entry once that version is older than the release-age gate. minimumReleaseAgeExclude: - - '@comfyorg/comfyui-desktop-bridge-types@0.4.0' + - '@comfyorg/comfyui-desktop-bridge-types@0.5.0' - '@comfyorg/comfy-multi-player@0.3.6' patchedDependencies: diff --git a/src/platform/auth/desktopHost/desktopHostAuthBridge.ts b/src/platform/auth/desktopHost/desktopHostAuthBridge.ts index bec9d81804a..60d11d5a801 100644 --- a/src/platform/auth/desktopHost/desktopHostAuthBridge.ts +++ b/src/platform/auth/desktopHost/desktopHostAuthBridge.ts @@ -5,8 +5,9 @@ import type { export type DesktopHostAuthState = ComfyDesktop2AuthState -/** `switchWorkspace` lands with bridge types 0.5.0 (Comfy-Desktop #1671). */ -export interface DesktopHostAuthBridge extends ComfyDesktop2AuthBridge { - /** Absent on Desktop builds before Comfy-Desktop #1671. */ - switchWorkspace?(workspaceId: string): Promise -} +/** `switchWorkspace` is absent on Desktop builds before Comfy-Desktop #1671. */ +export type DesktopHostAuthBridge = Omit< + ComfyDesktop2AuthBridge, + 'switchWorkspace' +> & + Partial> diff --git a/src/platform/workspace/stores/teamWorkspaceStore.test.ts b/src/platform/workspace/stores/teamWorkspaceStore.test.ts index 80c912a80c8..4a55629f61e 100644 --- a/src/platform/workspace/stores/teamWorkspaceStore.test.ts +++ b/src/platform/workspace/stores/teamWorkspaceStore.test.ts @@ -2400,6 +2400,25 @@ describe('useTeamWorkspaceStore', () => { expect(store.activeWorkspaceId).toBeNull() }) + it('reports a failed refresh and keeps no active workspace', async () => { + const store = useTeamWorkspaceStore() + await store.initialize() + const failure = new Error('list failed') + mockWorkspaceApi.list.mockRejectedValue(failure) + + pushHostState(hostOn(mockMemberWorkspace.id)) + + await vi.waitFor(() => + expect(reportError).toHaveBeenCalledWith( + failure, + expect.objectContaining({ + errorType: 'error_refreshing_workspaces_for_desktop_host' + }) + ) + ) + expect(store.activeWorkspaceId).toBeNull() + }) + it('follows a switch made in Desktop', async () => { mockWorkspaceApi.list.mockResolvedValue({ workspaces: [ diff --git a/src/platform/workspace/stores/teamWorkspaceStore.ts b/src/platform/workspace/stores/teamWorkspaceStore.ts index 8ce967f0d17..4f736bfa32c 100644 --- a/src/platform/workspace/stores/teamWorkspaceStore.ts +++ b/src/platform/workspace/stores/teamWorkspaceStore.ts @@ -1062,7 +1062,12 @@ export const useTeamWorkspaceStore = defineStore('teamWorkspace', () => { const isListed = () => workspaces.value.some((w) => w.id === hostWorkspaceId) if (!isListed()) { - await refreshWorkspaces().catch(() => undefined) + await refreshWorkspaces().catch((error: unknown) => + reportError(error, { + errorType: 'error_refreshing_workspaces_for_desktop_host', + surface: 'workspace' + }) + ) if ( isStaleIdentity(generation) || desktopHostUser.value?.workspaceId !== hostWorkspaceId