From cf072b84209550cc3771012ff60872869e1725d3 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Tue, 29 Jul 2025 00:32:39 -0700 Subject: [PATCH] [fix] Fix link input slots not being updated in subgraphs (#4575) --- src/utils/litegraphUtil.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils/litegraphUtil.ts b/src/utils/litegraphUtil.ts index 738fbd7ca..5f147b99b 100644 --- a/src/utils/litegraphUtil.ts +++ b/src/utils/litegraphUtil.ts @@ -153,7 +153,10 @@ export function migrateWidgetsValues( * @param graph - The graph to fix links for. */ export function fixLinkInputSlots(graph: LGraph) { + // Note: We can't use forEachNode here because we need access to the graph's + // links map at each level. Links are stored in their respective graph/subgraph. for (const node of graph.nodes) { + // Fix links for the current node for (const [inputIndex, input] of node.inputs.entries()) { const linkId = input.link if (!linkId) continue @@ -163,6 +166,11 @@ export function fixLinkInputSlots(graph: LGraph) { link.target_slot = inputIndex } + + // Recursively fix links in subgraphs + if (node.isSubgraphNode?.() && node.subgraph) { + fixLinkInputSlots(node.subgraph) + } } }