From cd444b6e590f1179719e7dbe22db66488f98928f Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Tue, 26 Aug 2025 19:59:55 -0700 Subject: [PATCH] [bugfix] Fix refresh node definitions for subgraph nodes (#5222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/scripts/app.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/scripts/app.ts b/src/scripts/app.ts index 3db03cc39..1e9df767e 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -63,6 +63,7 @@ import { ExtensionManager } from '@/types/extensionTypes' import type { NodeExecutionId } from '@/types/nodeIdentification' import { ColorAdjustOptions, adjustColor } from '@/utils/colorUtil' import { graphToPrompt } from '@/utils/executionUtil' +import { forEachNode } from '@/utils/graphTraversalUtil' import { getNodeByExecutionId, triggerCallbackOnAllNodes @@ -1700,12 +1701,13 @@ export class ComfyApp { for (const nodeId in defs) { this.registerNodeDef(nodeId, defs[nodeId]) } - for (const node of this.graph.nodes) { + // Refresh combo widgets in all nodes including those in subgraphs + forEachNode(this.graph, (node) => { const def = defs[node.type] // Allow primitive nodes to handle refresh node.refreshComboInNode?.(defs) - if (!def?.input) continue + if (!def?.input) return if (node.widgets) { const nodeInputs = def.input @@ -1732,7 +1734,7 @@ export class ComfyApp { } } } - } + }) await useExtensionService().invokeExtensionsAsync( 'refreshComboInNodes',