Skip to content

Commit 01e4260

Browse files
committed
Fix duplicated inputs on loading nested subgraphs
Subgraphs are loaded in order of creation. Under most circumstances, this means newer subgraphs are loaded first. With nested subgraphs, this means a subgraph node has it's inputs connected before it's inside is loaded. When the inner subgraph is loaded, input-added events are triggered even though inputs already exist on the subgraph node. This is resolved by adding a check for if an input of the corresponding name already exists when adding an input. Port of Comfy-Org/litegraph.js#1192
1 parent fad8dae commit 01e4260

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lib/litegraph/src/subgraph/SubgraphNode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
7272
(e) => {
7373
const subgraphInput = e.detail.input
7474
const { name, type } = subgraphInput
75+
if (this.inputs.some((i) => i.name == name)) return
7576
const input = this.addInput(name, type)
7677

7778
this.#addSubgraphInputListeners(subgraphInput, input)

0 commit comments

Comments
 (0)