[backport core/1.36] Fix linked asset widget promotion in vue (#8002)

Backport of #7895 to `core/1.36`

Automatically created by backport workflow.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8002-backport-core-1-36-Fix-linked-asset-widget-promotion-in-vue-2e76d73d365081609fa6d09552938bb9)
by [Unito](https://www.unito.io)

Co-authored-by: AustinMroz <austin@comfy.org>
This commit is contained in:
Comfy Org PR Bot
2026-01-13 14:15:45 +09:00
committed by GitHub
parent 0863baafad
commit a16db20e78
3 changed files with 8 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ import type {
} from '@/lib/litegraph/src/types/serialisation' } from '@/lib/litegraph/src/types/serialisation'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets' import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
import type { UUID } from '@/lib/litegraph/src/utils/uuid' 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 { toConcreteWidget } from '@/lib/litegraph/src/widgets/widgetMap'
import { ExecutableNodeDTO } from './ExecutableNodeDTO' import { ExecutableNodeDTO } from './ExecutableNodeDTO'
@@ -333,6 +334,8 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
const promotedWidget = toConcreteWidget(widget, this).createCopyForNode( const promotedWidget = toConcreteWidget(widget, this).createCopyForNode(
this this
) )
if (widget instanceof AssetWidget)
promotedWidget.options.nodeType ??= widget.node.type
Object.assign(promotedWidget, { Object.assign(promotedWidget, {
get name() { get name() {

View File

@@ -27,6 +27,8 @@ export interface IWidgetOptions<TValues = unknown[]> {
socketless?: boolean socketless?: boolean
/** If `true`, the widget will not be rendered by the Vue renderer. */ /** If `true`, the widget will not be rendered by the Vue renderer. */
canvasOnly?: boolean canvasOnly?: boolean
/** Used as a temporary override for determining the asset type in vue mode*/
nodeType?: string
values?: TValues values?: TValues
/** Optional function to format values for display (e.g., hash → human-readable name) */ /** Optional function to format values for display (e.g., hash → human-readable name) */

View File

@@ -60,8 +60,9 @@ const combinedProps = computed(() => ({
})) }))
const getAssetData = () => { const getAssetData = () => {
if (props.isAssetMode && props.nodeType) { const nodeType = props.widget.options?.nodeType ?? props.nodeType
return useAssetWidgetData(toRef(() => props.nodeType)) if (props.isAssetMode && nodeType) {
return useAssetWidgetData(toRef(nodeType))
} }
return null return null
} }