mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-11 08:00:21 +00:00
## Summary Fix non-widget inputs on nested subgraphs appearing twice — once as slots and once as unresolved button widgets. ## Changes - **What**: Add `getTargetWidget()` guard in the `isSubgraphNode()` branch of `resolveSubgraphInputTarget`, matching the existing check for non-subgraph nodes. Non-widget inputs (e.g. AUDIO, IMAGE) now return `undefined` instead of a bogus promotion entry. ## Review Focus `resolveSubgraphInputTarget` had an asymmetry: the non-subgraph branch checked `getTargetWidget()` before returning, but the `isSubgraphNode()` branch returned unconditionally for every input. For nested subgraphs where non-widget slots are linked through to inner SubgraphNode inputs, this created `PromotedWidgetView` entries that failed `resolveDeepest()` (falling back to `type: 'button'`), while the inputs also rendered as normal slot circles since `input.widget` was never set by `_resolveInputWidget` (which correctly skipped them). ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9542-fix-prevent-non-widget-inputs-on-nested-subgraphs-from-appearing-as-button-widgets-31c6d73d3650816387c3f97f0385e762) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com>
38 lines
904 B
TypeScript
38 lines
904 B
TypeScript
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
|
|
|
import { resolveSubgraphInputLink } from './resolveSubgraphInputLink'
|
|
|
|
type ResolvedSubgraphInputTarget = {
|
|
nodeId: string
|
|
widgetName: string
|
|
}
|
|
|
|
export function resolveSubgraphInputTarget(
|
|
node: LGraphNode,
|
|
inputName: string
|
|
): ResolvedSubgraphInputTarget | undefined {
|
|
return resolveSubgraphInputLink(
|
|
node,
|
|
inputName,
|
|
({ inputNode, targetInput, getTargetWidget }) => {
|
|
if (inputNode.isSubgraphNode()) {
|
|
const targetWidget = getTargetWidget()
|
|
if (!targetWidget) return undefined
|
|
|
|
return {
|
|
nodeId: String(inputNode.id),
|
|
widgetName: targetInput.name
|
|
}
|
|
}
|
|
|
|
const targetWidget = getTargetWidget()
|
|
if (!targetWidget) return undefined
|
|
|
|
return {
|
|
nodeId: String(inputNode.id),
|
|
widgetName: targetWidget.name
|
|
}
|
|
}
|
|
)
|
|
}
|