diff --git a/src/scripts/ui/menu/interruptButton.ts b/src/scripts/ui/menu/interruptButton.ts index e48245b0b..fd25156cc 100644 --- a/src/scripts/ui/menu/interruptButton.ts +++ b/src/scripts/ui/menu/interruptButton.ts @@ -16,7 +16,7 @@ export function getInteruptButton(visibility: string) { api.addEventListener( 'status', ({ detail }: CustomEvent) => { - const sz = detail.exec_info.queue_remaining + const sz = detail?.exec_info?.queue_remaining btn.enabled = sz > 0 } ) diff --git a/src/scripts/ui/menu/queueButton.ts b/src/scripts/ui/menu/queueButton.ts index 58558a955..19da770d2 100644 --- a/src/scripts/ui/menu/queueButton.ts +++ b/src/scripts/ui/menu/queueButton.ts @@ -85,7 +85,7 @@ export class ComfyQueueButton { api.addEventListener( 'status', ({ detail }: CustomEvent) => { - this.#internalQueueSize = detail.exec_info.queue_remaining + this.#internalQueueSize = detail?.exec_info?.queue_remaining if (this.#internalQueueSize != null) { if (!this.#internalQueueSize && !app.lastExecutionError) { if ( diff --git a/src/stores/queueStore.ts b/src/stores/queueStore.ts index 7eac63cba..955be9a58 100644 --- a/src/stores/queueStore.ts +++ b/src/stores/queueStore.ts @@ -214,7 +214,7 @@ export const useQueuePendingTaskCountStore = defineStore( }), actions: { update(e: CustomEvent) { - this.count = e.detail.exec_info.queue_remaining + this.count = e.detail?.exec_info?.queue_remaining || 0 } } } diff --git a/src/types/apiTypes.ts b/src/types/apiTypes.ts index 4c93dd307..fc8035630 100644 --- a/src/types/apiTypes.ts +++ b/src/types/apiTypes.ts @@ -19,7 +19,7 @@ const zStatusWsMessageStatus = z.object({ }) const zStatusWsMessage = z.object({ - status: zStatusWsMessageStatus + status: zStatusWsMessageStatus.nullable().optional() }) const zProgressWsMessage = z.object({