From 56a243f958cbc2a14e2dafe4557b76f17dfe0d8e Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 26 Dec 2024 15:21:58 -0500 Subject: [PATCH] [Refactor] Deprecate ComfyApp.progress (#2065) --- src/scripts/app.ts | 12 ++++++++---- src/stores/executionStore.ts | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/scripts/app.ts b/src/scripts/app.ts index e0e5ed4e4..64c4fed15 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -127,8 +127,6 @@ export class ComfyApp { lastNodeErrors: any[] | null /** @type {ExecutionErrorWsMessage} */ lastExecutionError: { node_id?: NodeId } | null - /** @type {ProgressWsMessage} */ - progress: { value?: number; max?: number } | null configuringGraph: boolean ctx: CanvasRenderingContext2D bodyTop: HTMLElement @@ -187,6 +185,14 @@ export class ComfyApp { return useExtensionStore().extensions } + /** + * The progress on the current executing node, if the node reports any. + * @deprecated Use useExecutionStore().executingNodeProgress instead + */ + get progress() { + return useExecutionStore()._executingNodeProgress + } + constructor() { this.vueAppReady = false this.ui = new ComfyUI(this) @@ -1484,12 +1490,10 @@ export class ComfyApp { }) api.addEventListener('progress', ({ detail }) => { - this.progress = detail this.graph.setDirtyCanvas(true, false) }) api.addEventListener('executing', ({ detail }) => { - this.progress = null this.graph.setDirtyCanvas(true, false) this.revokePreviews(this.runningNodeId) delete this.nodePreviewImages[this.runningNodeId] diff --git a/src/stores/executionStore.ts b/src/stores/executionStore.ts index 34780cca9..c749d853f 100644 --- a/src/stores/executionStore.ts +++ b/src/stores/executionStore.ts @@ -192,6 +192,8 @@ export const useExecutionStore = defineStore('execution', () => { executingNodeProgress, bindExecutionEvents, unbindExecutionEvents, - storePrompt + storePrompt, + // Raw executing progress data for backward compatibility in ComfyApp. + _executingNodeProgress } })