mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
[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:
@@ -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() {
|
||||||
|
|||||||
@@ -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) */
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user