mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 06:47:33 +00:00
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 https://github.com/Comfy-Org/litegraph.js/pull/1192
This commit is contained in:
@@ -72,6 +72,7 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
|
||||
(e) => {
|
||||
const subgraphInput = e.detail.input
|
||||
const { name, type } = subgraphInput
|
||||
if (this.inputs.some((i) => i.name == name)) return
|
||||
const input = this.addInput(name, type)
|
||||
|
||||
this.#addSubgraphInputListeners(subgraphInput, input)
|
||||
|
||||
Reference in New Issue
Block a user