Skip to content

Commit 34b8f42

Browse files
committed
[fix] Detect missing nodes in subgraphs
Use collectAllNodes to recursively scan subgraphs for missing custom nodes. Fixes #2032
1 parent 68f5067 commit 34b8f42

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/composables/nodePack/useMissingNodes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { app } from '@/scripts/app'
88
import { useComfyManagerStore } from '@/stores/comfyManagerStore'
99
import { useNodeDefStore } from '@/stores/nodeDefStore'
1010
import type { components } from '@/types/comfyRegistryTypes'
11+
import { collectAllNodes } from '@/utils/graphTraversalUtil'
1112

1213
/**
1314
* Composable to find missing NodePacks from workflow
@@ -56,7 +57,8 @@ export const useMissingNodes = () => {
5657
}
5758

5859
const missingCoreNodes = computed<Record<string, LGraphNode[]>>(() => {
59-
const missingNodes = app.graph.nodes.filter(isMissingCoreNode)
60+
const allNodes = collectAllNodes(app.graph)
61+
const missingNodes = allNodes.filter(isMissingCoreNode)
6062
return groupBy(missingNodes, (node) => String(node.properties?.ver || ''))
6163
})
6264

src/composables/nodePack/useWorkflowPacks.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { useNodeDefStore } from '@/stores/nodeDefStore'
99
import { useSystemStatsStore } from '@/stores/systemStatsStore'
1010
import { SelectedVersion, UseNodePacksOptions } from '@/types/comfyManagerTypes'
1111
import type { components } from '@/types/comfyRegistryTypes'
12+
import { collectAllNodes } from '@/utils/graphTraversalUtil'
1213

1314
type WorkflowPack = {
1415
id:
@@ -109,11 +110,13 @@ export const useWorkflowPacks = (options: UseNodePacksOptions = {}) => {
109110
}
110111

111112
/**
112-
* Get the node packs for all nodes in the workflow.
113+
* Get the node packs for all nodes in the workflow (including subgraphs).
113114
*/
114115
const getWorkflowPacks = async () => {
115-
if (!app.graph?.nodes?.length) return []
116-
const packs = await Promise.all(app.graph.nodes.map(workflowNodeToPack))
116+
if (!app.graph) return []
117+
const allNodes = collectAllNodes(app.graph)
118+
if (!allNodes.length) return []
119+
const packs = await Promise.all(allNodes.map(workflowNodeToPack))
117120
workflowPacks.value = packs.filter((pack) => pack !== undefined)
118121
}
119122

0 commit comments

Comments
 (0)