Skip to content

Commit 1e47ddc

Browse files
AustinMrozDrJKL
authored andcommitted
Fix input duplication on load
1 parent 61018bb commit 1e47ddc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/extensions/core/dynamicCombo.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ function COMFY_DYNAMICCOMBO_V3(
7575
addedWidget.name = `${widget.name}.${addedWidget.name}`
7676
}
7777
node.widgets.splice(insertionPoint, 0, ...addedWidgets)
78-
node.size[1] = node.computeSize([...node.size])[1]
7978
for (const input of node.inputs.slice(startingInputLength)) {
8079
input.name = `${widget.name}.${input.name}`
8180
if (input.widget)
@@ -90,8 +89,17 @@ function COMFY_DYNAMICCOMBO_V3(
9089
throw new Error('Failed to find input socket for ' + widget.name)
9190
return
9291
}
93-
const addedInputs = node.spliceInputs(startingInputLength)
92+
const addedInputs = node
93+
.spliceInputs(startingInputLength)
94+
.filter(
95+
(addedInput) =>
96+
!node.inputs.some(
97+
(existingInput) => addedInput.name === existingInput.name
98+
)
99+
)
100+
//assume existing inputs are in correct order
94101
node.spliceInputs(inputInsertionPoint, 0, ...addedInputs)
102+
node.size[1] = node.computeSize([...node.size])[1]
95103
}
96104
//A little hacky, but onConfigure won't work.
97105
//It fires too late and is overly disruptive

0 commit comments

Comments
 (0)