Skip to content

Commit cd444b6

Browse files
[bugfix] Fix refresh node definitions for subgraph nodes (#5222)
The refreshComboInNodes function was only iterating over top-level nodes, missing nodes inside subgraphs. This caused file lists and combo widget options to not update properly when new models were added, unless users created completely new nodes. Changes: - Replace graph.nodes iteration with forEachNode() for hierarchical traversal - Import forEachNode utility from graphTraversalUtil - Change early continue to early return for callback function Fixes #5196 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <[email protected]>
1 parent 48b1ebf commit cd444b6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/scripts/app.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import { ExtensionManager } from '@/types/extensionTypes'
6363
import type { NodeExecutionId } from '@/types/nodeIdentification'
6464
import { ColorAdjustOptions, adjustColor } from '@/utils/colorUtil'
6565
import { graphToPrompt } from '@/utils/executionUtil'
66+
import { forEachNode } from '@/utils/graphTraversalUtil'
6667
import {
6768
getNodeByExecutionId,
6869
triggerCallbackOnAllNodes
@@ -1700,12 +1701,13 @@ export class ComfyApp {
17001701
for (const nodeId in defs) {
17011702
this.registerNodeDef(nodeId, defs[nodeId])
17021703
}
1703-
for (const node of this.graph.nodes) {
1704+
// Refresh combo widgets in all nodes including those in subgraphs
1705+
forEachNode(this.graph, (node) => {
17041706
const def = defs[node.type]
17051707
// Allow primitive nodes to handle refresh
17061708
node.refreshComboInNode?.(defs)
17071709

1708-
if (!def?.input) continue
1710+
if (!def?.input) return
17091711

17101712
if (node.widgets) {
17111713
const nodeInputs = def.input
@@ -1732,7 +1734,7 @@ export class ComfyApp {
17321734
}
17331735
}
17341736
}
1735-
}
1737+
})
17361738

17371739
await useExtensionService().invokeExtensionsAsync(
17381740
'refreshComboInNodes',

0 commit comments

Comments
 (0)