diff --git a/src/scripts/app.ts b/src/scripts/app.ts index c1474de52..e7edebbc0 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -690,6 +690,7 @@ export class ComfyApp { api.addEventListener('b_preview_with_metadata', ({ detail }) => { // Enhanced preview with explicit node context const { blob, displayNodeId } = detail + // Ensure clean up if `executing` event is missed. this.revokePreviews(displayNodeId) const blobUrl = URL.createObjectURL(blob) // Preview cleanup is now handled in progress_state event to support multiple concurrent previews diff --git a/src/stores/executionStore.ts b/src/stores/executionStore.ts index dad7981dc..377528769 100644 --- a/src/stores/executionStore.ts +++ b/src/stores/executionStore.ts @@ -222,6 +222,7 @@ export const useExecutionStore = defineStore('execution', () => { function bindExecutionEvents() { api.addEventListener('execution_start', handleExecutionStart) api.addEventListener('execution_cached', handleExecutionCached) + api.addEventListener('execution_interrupted', handleExecutionInterrupted) api.addEventListener('executed', handleExecuted) api.addEventListener('executing', handleExecuting) api.addEventListener('progress', handleProgress) @@ -235,6 +236,7 @@ export const useExecutionStore = defineStore('execution', () => { function unbindExecutionEvents() { api.removeEventListener('execution_start', handleExecutionStart) api.removeEventListener('execution_cached', handleExecutionCached) + api.removeEventListener('execution_interrupted', handleExecutionInterrupted) api.removeEventListener('executed', handleExecuted) api.removeEventListener('executing', handleExecuting) api.removeEventListener('progress', handleProgress) @@ -257,6 +259,10 @@ export const useExecutionStore = defineStore('execution', () => { } } + function handleExecutionInterrupted() { + nodeProgressStates.value = {} + } + function handleExecuted(e: CustomEvent) { if (!activePrompt.value) return activePrompt.value.nodes[e.detail.node] = true