mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
Backport of #9542 to core/1.41.
Cherry-pick of merge commit 8a5bcde1 applied cleanly.
**Original PR:** https://github.com/Comfy-Org/ComfyUI_frontend/pull/9542
**Pipeline ticket:** 15e1f241-efaa-4fe5-88ca-4ccc7bfb3345
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9563-backport-core-1-41-fix-prevent-non-widget-inputs-on-nested-subgraphs-from-appearing-as-31d6d73d36508154927fd4b7b55ea87f)
by [Unito](https://www.unito.io)
Co-authored-by: Alexander Brown <drjkl@comfy.org>
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
|
|
}
|
|
}
|
|
)
|
|
}
|