From 2da833854a120caf699dd5089c178aa210a32051 Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Tue, 13 Jan 2026 14:49:26 +0900 Subject: [PATCH] [backport cloud/1.36] Dynamic input fixes (#8008) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of #7837 to `cloud/1.36` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8008-backport-cloud-1-36-Dynamic-input-fixes-2e76d73d3650811186daca4b7e20b83a) by [Unito](https://www.unito.io) Co-authored-by: AustinMroz --- src/core/graph/widgets/dynamicWidgets.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/core/graph/widgets/dynamicWidgets.ts b/src/core/graph/widgets/dynamicWidgets.ts index efef4a398..406822d43 100644 --- a/src/core/graph/widgets/dynamicWidgets.ts +++ b/src/core/graph/widgets/dynamicWidgets.ts @@ -94,7 +94,7 @@ function dynamicComboWidget( const newSpec = value ? options[value] : undefined const removedInputs = remove(node.inputs, isInGroup) - remove(node.widgets, isInGroup) + for (const widget of remove(node.widgets, isInGroup)) widget.onRemove?.() if (!newSpec) return @@ -341,10 +341,16 @@ function applyMatchType(node: LGraphNode, inputSpec: InputSpecV2) { //TODO: instead apply on output add? //ensure outputs get updated const index = node.inputs.length - 1 - const input = node.inputs.at(-1)! - requestAnimationFrame(() => - node.onConnectionsChange(LiteGraph.INPUT, index, false, undefined, input) - ) + requestAnimationFrame(() => { + const input = node.inputs.at(index)! + node.onConnectionsChange?.( + LiteGraph.INPUT, + index, + !!input.link, + input.link ? node.graph?.links?.[input.link] : undefined, + input + ) + }) } function autogrowOrdinalToName( @@ -482,7 +488,8 @@ function autogrowInputDisconnected(index: number, node: AutogrowNode) { for (const input of toRemove) { const widgetName = input?.widget?.name if (!widgetName) continue - remove(node.widgets, (w) => w.name === widgetName) + for (const widget of remove(node.widgets, (w) => w.name === widgetName)) + widget.onRemove?.() } node.size[1] = node.computeSize([...node.size])[1] }