Skip to content

Commit cf072b8

Browse files
[fix] Fix link input slots not being updated in subgraphs (#4575)
1 parent 4b75528 commit cf072b8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/utils/litegraphUtil.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ export function migrateWidgetsValues<TWidgetValue>(
153153
* @param graph - The graph to fix links for.
154154
*/
155155
export function fixLinkInputSlots(graph: LGraph) {
156+
// Note: We can't use forEachNode here because we need access to the graph's
157+
// links map at each level. Links are stored in their respective graph/subgraph.
156158
for (const node of graph.nodes) {
159+
// Fix links for the current node
157160
for (const [inputIndex, input] of node.inputs.entries()) {
158161
const linkId = input.link
159162
if (!linkId) continue
@@ -163,6 +166,11 @@ export function fixLinkInputSlots(graph: LGraph) {
163166

164167
link.target_slot = inputIndex
165168
}
169+
170+
// Recursively fix links in subgraphs
171+
if (node.isSubgraphNode?.() && node.subgraph) {
172+
fixLinkInputSlots(node.subgraph)
173+
}
166174
}
167175
}
168176

0 commit comments

Comments
 (0)