[Refactor] Deprecate ComfyApp.progress (#2065)

This commit is contained in:
Chenlei Hu
2024-12-26 15:21:58 -05:00
committed by GitHub
parent c311806249
commit 56a243f958
2 changed files with 11 additions and 5 deletions

View File

@@ -127,8 +127,6 @@ export class ComfyApp {
lastNodeErrors: any[] | null lastNodeErrors: any[] | null
/** @type {ExecutionErrorWsMessage} */ /** @type {ExecutionErrorWsMessage} */
lastExecutionError: { node_id?: NodeId } | null lastExecutionError: { node_id?: NodeId } | null
/** @type {ProgressWsMessage} */
progress: { value?: number; max?: number } | null
configuringGraph: boolean configuringGraph: boolean
ctx: CanvasRenderingContext2D ctx: CanvasRenderingContext2D
bodyTop: HTMLElement bodyTop: HTMLElement
@@ -187,6 +185,14 @@ export class ComfyApp {
return useExtensionStore().extensions 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() { constructor() {
this.vueAppReady = false this.vueAppReady = false
this.ui = new ComfyUI(this) this.ui = new ComfyUI(this)
@@ -1484,12 +1490,10 @@ export class ComfyApp {
}) })
api.addEventListener('progress', ({ detail }) => { api.addEventListener('progress', ({ detail }) => {
this.progress = detail
this.graph.setDirtyCanvas(true, false) this.graph.setDirtyCanvas(true, false)
}) })
api.addEventListener('executing', ({ detail }) => { api.addEventListener('executing', ({ detail }) => {
this.progress = null
this.graph.setDirtyCanvas(true, false) this.graph.setDirtyCanvas(true, false)
this.revokePreviews(this.runningNodeId) this.revokePreviews(this.runningNodeId)
delete this.nodePreviewImages[this.runningNodeId] delete this.nodePreviewImages[this.runningNodeId]

View File

@@ -192,6 +192,8 @@ export const useExecutionStore = defineStore('execution', () => {
executingNodeProgress, executingNodeProgress,
bindExecutionEvents, bindExecutionEvents,
unbindExecutionEvents, unbindExecutionEvents,
storePrompt storePrompt,
// Raw executing progress data for backward compatibility in ComfyApp.
_executingNodeProgress
} }
}) })