Skip to content

Commit 91e21b1

Browse files
authored
Update ws message schema on reconnecting (#390)
* Update ws message schema on reconnecting * nit
1 parent a5be1f6 commit 91e21b1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/scripts/ui/menu/interruptButton.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function getInteruptButton(visibility: string) {
1616
api.addEventListener(
1717
'status',
1818
({ detail }: CustomEvent<StatusWsMessageStatus>) => {
19-
const sz = detail.exec_info.queue_remaining
19+
const sz = detail?.exec_info?.queue_remaining
2020
btn.enabled = sz > 0
2121
}
2222
)

src/scripts/ui/menu/queueButton.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class ComfyQueueButton {
8585
api.addEventListener(
8686
'status',
8787
({ detail }: CustomEvent<StatusWsMessageStatus>) => {
88-
this.#internalQueueSize = detail.exec_info.queue_remaining
88+
this.#internalQueueSize = detail?.exec_info?.queue_remaining
8989
if (this.#internalQueueSize != null) {
9090
if (!this.#internalQueueSize && !app.lastExecutionError) {
9191
if (

src/stores/queueStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export const useQueuePendingTaskCountStore = defineStore(
214214
}),
215215
actions: {
216216
update(e: CustomEvent<StatusWsMessageStatus>) {
217-
this.count = e.detail.exec_info.queue_remaining
217+
this.count = e.detail?.exec_info?.queue_remaining || 0
218218
}
219219
}
220220
}

src/types/apiTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const zStatusWsMessageStatus = z.object({
1919
})
2020

2121
const zStatusWsMessage = z.object({
22-
status: zStatusWsMessageStatus
22+
status: zStatusWsMessageStatus.nullable().optional()
2323
})
2424

2525
const zProgressWsMessage = z.object({

0 commit comments

Comments
 (0)