[bugfix] Fix TypeScript errors in SubgraphNode type checking

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 <noreply@anthropic.com>
This commit is contained in:
snomiao
2025-08-13 13:28:55 +00:00
parent ac37a5e375
commit cd787c56d9

View File

@@ -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)
}