mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 20:51:58 +00:00
Fix group node naming compatibility (#969)
* Convery legacy group node names in workflow * Add Playwright test * Remove hardcoded strings
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
} from '@comfyorg/litegraph'
|
||||
|
||||
const ORDER: symbol = Symbol()
|
||||
const PREFIX = 'workflow'
|
||||
const SEPARATOR = '>'
|
||||
|
||||
function merge(target, source) {
|
||||
if (typeof target === 'object' && typeof source === 'object') {
|
||||
@@ -102,7 +104,9 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
|
||||
getGroupData() {
|
||||
this.groupNodeType =
|
||||
LiteGraph.registered_node_types['workflow>' + this.selectedGroup]
|
||||
LiteGraph.registered_node_types[
|
||||
`${PREFIX}${SEPARATOR}` + this.selectedGroup
|
||||
]
|
||||
this.groupNodeDef = this.groupNodeType.nodeData
|
||||
this.groupData = GroupNodeHandler.getGroupData(this.groupNodeType)
|
||||
}
|
||||
@@ -367,7 +371,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
groupNodes.map((g) =>
|
||||
$el('option', {
|
||||
textContent: g,
|
||||
selected: 'workflow>' + g === type,
|
||||
selected: `${PREFIX}${SEPARATOR}` + g === type,
|
||||
value: g
|
||||
})
|
||||
)
|
||||
@@ -389,7 +393,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
{
|
||||
onclick: (e) => {
|
||||
const node = app.graph.nodes.find(
|
||||
(n) => n.type === 'workflow>' + this.selectedGroup
|
||||
(n) => n.type === `${PREFIX}${SEPARATOR}` + this.selectedGroup
|
||||
)
|
||||
if (node) {
|
||||
alert(
|
||||
@@ -403,7 +407,9 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
)
|
||||
) {
|
||||
delete app.graph.extra.groupNodes[this.selectedGroup]
|
||||
LiteGraph.unregisterNodeType('workflow>' + this.selectedGroup)
|
||||
LiteGraph.unregisterNodeType(
|
||||
`${PREFIX}${SEPARATOR}` + this.selectedGroup
|
||||
)
|
||||
}
|
||||
this.show()
|
||||
}
|
||||
@@ -476,7 +482,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
}, {})
|
||||
}
|
||||
|
||||
const nodes = nodesByType['workflow>' + g]
|
||||
const nodes = nodesByType[`${PREFIX}${SEPARATOR}` + g]
|
||||
if (nodes) recreateNodes.push(...nodes)
|
||||
}
|
||||
|
||||
@@ -503,7 +509,9 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
|
||||
|
||||
this.element.replaceChildren(outer)
|
||||
this.changeGroup(
|
||||
type ? groupNodes.find((g) => 'workflow>' + g === type) : groupNodes[0]
|
||||
type
|
||||
? groupNodes.find((g) => `${PREFIX}${SEPARATOR}` + g === type)
|
||||
: groupNodes[0]
|
||||
)
|
||||
this.element.showModal()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user