diff --git a/src/scripts/app.ts b/src/scripts/app.ts index 018f6005c2..fe640c0eed 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -1955,6 +1955,37 @@ export class ComfyApp { this.canvas?.draw(true, true) } + updateVueAppNodeDefs(defs: Record) { + // Frontend only nodes registered by custom nodes. + // Example: https://github.com/rgthree/rgthree-comfy/blob/dd534e5384be8cf0c0fa35865afe2126ba75ac55/src_web/comfyui/fast_groups_bypasser.ts#L10 + const rawDefs = Object.fromEntries( + Object.entries(LiteGraph.registered_node_types).map(([name, _]) => [ + name, + { + name, + display_name: name, + category: '__frontend_only__', + input: { required: {}, optional: {} }, + output: [], + output_name: [], + output_is_list: [], + python_module: 'custom_nodes.frontend_only', + description: `Frontend only node for ${name}` + } + ]) + ) + + const allNodeDefs = { + ...rawDefs, + ...defs, + ...SYSTEM_NODE_DEFS + } + + const nodeDefStore = useNodeDefStore() + nodeDefStore.updateNodeDefs(Object.values(allNodeDefs)) + nodeDefStore.updateWidgets(this.widgets) + } + /** * Registers nodes with the graph */ @@ -1964,34 +1995,7 @@ export class ComfyApp { await this.registerNodesFromDefs(defs) await this.#invokeExtensionsAsync('registerCustomNodes') if (this.vueAppReady) { - // Frontend only nodes registered by custom nodes. - // Example: https://github.com/rgthree/rgthree-comfy/blob/dd534e5384be8cf0c0fa35865afe2126ba75ac55/src_web/comfyui/fast_groups_bypasser.ts#L10 - const rawDefs = Object.fromEntries( - Object.entries(LiteGraph.registered_node_types).map(([name, _]) => [ - name, - { - name, - display_name: name, - category: '__frontend_only__', - input: { required: {}, optional: {} }, - output: [], - output_name: [], - output_is_list: [], - python_module: 'custom_nodes.frontend_only', - description: `Frontend only node for ${name}` - } - ]) - ) - - const allNodeDefs = { - ...rawDefs, - ...defs, - ...SYSTEM_NODE_DEFS - } - - const nodeDefStore = useNodeDefStore() - nodeDefStore.updateNodeDefs(Object.values(allNodeDefs)) - nodeDefStore.updateWidgets(this.widgets) + this.updateVueAppNodeDefs(defs) } } @@ -2899,6 +2903,7 @@ export class ComfyApp { await this.#invokeExtensionsAsync('refreshComboInNodes', defs) if (this.vueAppReady) { + this.updateVueAppNodeDefs(defs) useToastStore().remove(requestToastMessage) useToastStore().add({ severity: 'success',