[Refactor] Remove app.getWidgetType (#2880)

This commit is contained in:
Chenlei Hu
2025-03-05 14:02:13 -05:00
committed by GitHub
parent ba4e4ed0b8
commit 15e396b4cc
5 changed files with 21 additions and 44 deletions

View File

@@ -12,6 +12,7 @@ import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
import { useDialogService } from '@/services/dialogService'
import { useNodeDefStore } from '@/stores/nodeDefStore'
import { useToastStore } from '@/stores/toastStore'
import { useWidgetStore } from '@/stores/widgetStore'
import { ComfyExtension } from '@/types/comfy'
import { deserialiseAndCreate, serialise } from '@/utils/vintageClipboard'
@@ -442,8 +443,7 @@ export class GroupNodeConfig {
const converted = new Map()
const widgetMap = (this.oldToNewWidgetMap[node.index] = {})
for (const inputName of inputNames) {
let widgetType = app.getWidgetType(inputs[inputName], inputName)
if (widgetType) {
if (useWidgetStore().inputIsWidget(inputs[inputName])) {
const convertedIndex = node.inputs?.findIndex(
(inp) => inp.name === inputName && inp.widget?.name === inputName
)

View File

@@ -1,5 +1,5 @@
// @ts-strict-ignore
import type { IWidget } from '@comfyorg/litegraph'
import type { IWidget, LGraphNode } from '@comfyorg/litegraph'
import type { IStringWidget } from '@comfyorg/litegraph/dist/types/widgets'
import { useNodeDragAndDrop } from '@/composables/node/useNodeDragAndDrop'
@@ -97,7 +97,7 @@ app.registerExtension({
},
getCustomWidgets() {
return {
AUDIO_UI(node, inputName: string) {
AUDIO_UI(node: LGraphNode, inputName: string) {
const audio = document.createElement('audio')
audio.controls = true
audio.classList.add('comfy-audio')