Fix node def registeration (#803)

This commit is contained in:
Chenlei Hu
2024-09-12 20:17:21 +09:00
committed by GitHub
parent 637f5b501e
commit 8889c4de4a
2 changed files with 5 additions and 2 deletions

View File

@@ -2013,7 +2013,7 @@ export class ComfyApp {
// TODO: change to "title?" once litegraph.d.ts has been updated
static title = nodeData.display_name || nodeData.name
static nodeData? = nodeData
static category: string = nodeData.category
static category?: string
constructor(title?: string) {
super(title)
@@ -2092,6 +2092,9 @@ export class ComfyApp {
await this.#invokeExtensionsAsync('beforeRegisterNodeDef', node, nodeData)
LiteGraph.registerNodeType(nodeId, node)
// Note: Do not move this to the class definition, it will be overwritten
// @ts-expect-error
node.category = nodeData.category
}
async registerNodesFromDefs(defs: Record<string, ComfyNodeDef>) {

View File

@@ -5,7 +5,7 @@ export declare class ComfyLGraphNode extends LGraphNode {
static comfyClass: string
static title: string
static nodeData?: ComfyNodeDef
static category: string
static category?: string
constructor(title?: string)
}