From 8889c4de4a985c1a0a6ead958f0d77e657d5e701 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 12 Sep 2024 20:17:21 +0900 Subject: [PATCH] Fix node def registeration (#803) --- src/scripts/app.ts | 5 ++++- src/types/comfyLGraphNode.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/scripts/app.ts b/src/scripts/app.ts index d7808c294..0f9a83b03 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -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) { diff --git a/src/types/comfyLGraphNode.ts b/src/types/comfyLGraphNode.ts index 7d4ed62ae..ad06a10ac 100644 --- a/src/types/comfyLGraphNode.ts +++ b/src/types/comfyLGraphNode.ts @@ -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) }