mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-03 04:00:31 +00:00
Properly update vue app's node defs on refresh (#493)
This commit is contained in:
@@ -1955,6 +1955,37 @@ export class ComfyApp {
|
||||
this.canvas?.draw(true, true)
|
||||
}
|
||||
|
||||
updateVueAppNodeDefs(defs: Record<string, ComfyNodeDef>) {
|
||||
// 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',
|
||||
|
||||
Reference in New Issue
Block a user