From 6d09b7165f3f39642c0b593d751cf7a1961bf81b Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 2 Apr 2025 11:16:36 -0400 Subject: [PATCH] [TS] Fix event type for executing listener (#3310) --- src/components/graph/GraphCanvas.vue | 3 ++- src/scripts/app.ts | 2 +- src/stores/executionStore.ts | 9 ++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index 6a214c8a5..a3e7e9a64 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -62,6 +62,7 @@ import { usePaste } from '@/composables/usePaste' import { useWorkflowPersistence } from '@/composables/useWorkflowPersistence' import { CORE_SETTINGS } from '@/constants/coreSettings' import { i18n } from '@/i18n' +import type { NodeId } from '@/schemas/comfyWorkflowSchema' import { UnauthorizedError, api } from '@/scripts/api' import { app as comfyApp } from '@/scripts/app' import { ChangeTracker } from '@/scripts/changeTracker' @@ -165,7 +166,7 @@ watch( watch( () => [executionStore.executingNodeId, executionStore.executingNodeProgress] as [ - string | null, + NodeId | null, number | null ], ([executingNodeId, executingNodeProgress]) => { diff --git a/src/scripts/app.ts b/src/scripts/app.ts index f59bed5d9..b17b93298 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -162,7 +162,7 @@ export class ComfyApp { /** * @deprecated Use useExecutionStore().executingNodeId instead */ - get runningNodeId(): string | null { + get runningNodeId(): NodeId | null { return useExecutionStore().executingNodeId } diff --git a/src/stores/executionStore.ts b/src/stores/executionStore.ts index a8988da84..554ae5a88 100644 --- a/src/stores/executionStore.ts +++ b/src/stores/executionStore.ts @@ -3,7 +3,6 @@ import { computed, ref } from 'vue' import type { ExecutedWsMessage, - ExecutingWsMessage, ExecutionCachedWsMessage, ExecutionErrorWsMessage, ExecutionStartWsMessage, @@ -37,7 +36,7 @@ export const useExecutionStore = defineStore('execution', () => { const queuedPrompts = ref>({}) const lastNodeErrors = ref | null>(null) const lastExecutionError = ref(null) - const executingNodeId = ref(null) + const executingNodeId = ref(null) const executingNode = computed(() => { if (!executingNodeId.value) return null @@ -142,7 +141,7 @@ export const useExecutionStore = defineStore('execution', () => { activePrompt.value.nodes[e.detail.node] = true } - function handleExecuting(e: CustomEvent) { + function handleExecuting(e: CustomEvent) { // Clear the current node progress when a new node starts executing _executingNodeProgress.value = null @@ -152,8 +151,8 @@ export const useExecutionStore = defineStore('execution', () => { // Seems sometimes nodes that are cached fire executing but not executed activePrompt.value.nodes[executingNodeId.value] = true } - executingNodeId.value = e.detail ? String(e.detail) : null - if (!executingNodeId.value) { + executingNodeId.value = e.detail + if (executingNodeId.value === null) { if (activePromptId.value) { delete queuedPrompts.value[activePromptId.value] }