From 99cb7a2da187b93135d28faa104aae9f7c3ab8b4 Mon Sep 17 00:00:00 2001 From: AustinMroz Date: Thu, 8 Jan 2026 09:12:02 -0800 Subject: [PATCH] Fix linked asset widget promotion in vue (#7895) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Asset widgets resolve the list of models by checking the name of the node the widget is contained on. When an asset widget is linked to a subgraph node, a clone is made of the widget and then the clone is used to initialize an asset widget in vue mode. Since the widget no longer holds any form of reference to the original node, asset data fails to resolve. This is fixed by storing the original nodeType as an option on the cloned widget when an asset widget is linked to a subgraph input. | Before | After | | ------ | ----- | | before | after| See also #7563, #7560 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7895-Fix-linked-asset-widget-promotion-in-vue-2e26d73d365081e5b295f6236458b978) by [Unito](https://www.unito.io) --- src/lib/litegraph/src/subgraph/SubgraphNode.ts | 3 +++ src/lib/litegraph/src/types/widgets.ts | 2 ++ .../vueNodes/widgets/components/WidgetSelectDropdown.vue | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/litegraph/src/subgraph/SubgraphNode.ts b/src/lib/litegraph/src/subgraph/SubgraphNode.ts index 43f59b5166..e26e1cd48c 100644 --- a/src/lib/litegraph/src/subgraph/SubgraphNode.ts +++ b/src/lib/litegraph/src/subgraph/SubgraphNode.ts @@ -28,6 +28,7 @@ import type { } from '@/lib/litegraph/src/types/serialisation' import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets' import type { UUID } from '@/lib/litegraph/src/utils/uuid' +import { AssetWidget } from '@/lib/litegraph/src/widgets/AssetWidget' import { toConcreteWidget } from '@/lib/litegraph/src/widgets/widgetMap' import { ExecutableNodeDTO } from './ExecutableNodeDTO' @@ -333,6 +334,8 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph { const promotedWidget = toConcreteWidget(widget, this).createCopyForNode( this ) + if (widget instanceof AssetWidget) + promotedWidget.options.nodeType ??= widget.node.type Object.assign(promotedWidget, { get name() { diff --git a/src/lib/litegraph/src/types/widgets.ts b/src/lib/litegraph/src/types/widgets.ts index 1cfb323d8f..b2cf115575 100644 --- a/src/lib/litegraph/src/types/widgets.ts +++ b/src/lib/litegraph/src/types/widgets.ts @@ -27,6 +27,8 @@ export interface IWidgetOptions { socketless?: boolean /** If `true`, the widget will not be rendered by the Vue renderer. */ canvasOnly?: boolean + /** Used as a temporary override for determining the asset type in vue mode*/ + nodeType?: string values?: TValues /** Optional function to format values for display (e.g., hash → human-readable name) */ diff --git a/src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.vue b/src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.vue index f460390a23..84cb49218e 100644 --- a/src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.vue +++ b/src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.vue @@ -60,8 +60,9 @@ const combinedProps = computed(() => ({ })) const getAssetData = () => { - if (props.isAssetMode && props.nodeType) { - return useAssetWidgetData(toRef(() => props.nodeType)) + const nodeType = props.widget.options?.nodeType ?? props.nodeType + if (props.isAssetMode && nodeType) { + return useAssetWidgetData(toRef(nodeType)) } return null }