Skip to content

Commit b096850

Browse files
authored
Fix progress stuck after execution interrupted (#4503)
1 parent 7eb3eb2 commit b096850

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/scripts/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ export class ComfyApp {
690690
api.addEventListener('b_preview_with_metadata', ({ detail }) => {
691691
// Enhanced preview with explicit node context
692692
const { blob, displayNodeId } = detail
693+
// Ensure clean up if `executing` event is missed.
693694
this.revokePreviews(displayNodeId)
694695
const blobUrl = URL.createObjectURL(blob)
695696
// Preview cleanup is now handled in progress_state event to support multiple concurrent previews

src/stores/executionStore.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ export const useExecutionStore = defineStore('execution', () => {
222222
function bindExecutionEvents() {
223223
api.addEventListener('execution_start', handleExecutionStart)
224224
api.addEventListener('execution_cached', handleExecutionCached)
225+
api.addEventListener('execution_interrupted', handleExecutionInterrupted)
225226
api.addEventListener('executed', handleExecuted)
226227
api.addEventListener('executing', handleExecuting)
227228
api.addEventListener('progress', handleProgress)
@@ -235,6 +236,7 @@ export const useExecutionStore = defineStore('execution', () => {
235236
function unbindExecutionEvents() {
236237
api.removeEventListener('execution_start', handleExecutionStart)
237238
api.removeEventListener('execution_cached', handleExecutionCached)
239+
api.removeEventListener('execution_interrupted', handleExecutionInterrupted)
238240
api.removeEventListener('executed', handleExecuted)
239241
api.removeEventListener('executing', handleExecuting)
240242
api.removeEventListener('progress', handleProgress)
@@ -257,6 +259,10 @@ export const useExecutionStore = defineStore('execution', () => {
257259
}
258260
}
259261

262+
function handleExecutionInterrupted() {
263+
nodeProgressStates.value = {}
264+
}
265+
260266
function handleExecuted(e: CustomEvent<ExecutedWsMessage>) {
261267
if (!activePrompt.value) return
262268
activePrompt.value.nodes[e.detail.node] = true

0 commit comments

Comments
 (0)