From cd787c56d9cd6a668b2ea49f43c5720ae2958f41 Mon Sep 17 00:00:00 2001 From: snomiao Date: Wed, 13 Aug 2025 13:28:55 +0000 Subject: [PATCH] [bugfix] Fix TypeScript errors in SubgraphNode type checking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add proper type validation for subgraph node selection before calling SubgraphNode-specific methods. This prevents undefined values from being passed to functions expecting SubgraphNode parameters. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/composables/useCoreCommands.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/composables/useCoreCommands.ts b/src/composables/useCoreCommands.ts index dccdbed43..80eeca78f 100644 --- a/src/composables/useCoreCommands.ts +++ b/src/composables/useCoreCommands.ts @@ -10,7 +10,8 @@ import { LGraphEventMode, LGraphGroup, LGraphNode, - LiteGraph + LiteGraph, + SubgraphNode } from '@/lib/litegraph/src/litegraph' import { Point } from '@/lib/litegraph/src/litegraph' import { api } from '@/scripts/api' @@ -823,6 +824,7 @@ export function useCoreCommands(): ComfyCommand[] { if (!graph) throw new TypeError('Canvas has no graph or subgraph set.') const subgraphNode = app.canvas.selectedItems.values().next().value + if (!(subgraphNode instanceof SubgraphNode)) return useNodeOutputStore().revokeSubgraphPreviews(subgraphNode) graph.unpackSubgraph(subgraphNode) }