ComfyUI_frontend
ComfyUI_frontend copied to clipboard
[Bug]: 'Reroute' nodes shrink after loading .json file
Frontend Version
v1.2.44
Expected Behavior
When saving a workflow to a .json file and reloading it, 'Reroute' nodes should retain their original size, ensuring that the name the user has given to the slot remains visible.
Actual Behavior
After saving the workflow to a .json file and reloading it, the 'Reroute' nodes become smaller. This change not only alters the workflow layout but also results in a size so small that the slot name exceeds the node's boundaries, making it difficult to read.
Steps to Reproduce
- Create a new workflow in ComfyUI.
- Add a KSampler node, a pair of CLIP Text Encoders, and connect them using the 'Reroute' node.
- Modify the Reroute slot name by entering a long piece of text.
- Adjust the size of these nodes to ensure they are large enough to display the slot name correctly.
- Save the workflow as a .json file.
- Reload the workflow from the .json file.
- Observe that the size of the 'Reroute' nodes has shrunk, and the slot name is outside the node's boundaries.
reroute-bug.json
Debug Logs
otal VRAM 9906 MB, total RAM 31809 MB
pytorch version: 2.4.0+cu124
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3080 : cudaMallocAsync
Using pytorch cross attention
Downloading frontend(Comfy-Org_ComfyUI_frontend) version(1.2.44) to (/home/aiman/AIMan/Repos/comfyui/web_custom_versions/Comfy-Org_ComfyUI_frontend/1.2.44)
[Prompt Server] web root: /home/aiman/AIMan/Repos/comfyui/web_custom_versions/Comfy-Org_ComfyUI_frontend/1.2.44
Skipping loading of custom nodes
Starting server
To see the GUI go to: http://127.0.0.1:8086
Browser Logs
-
What browsers do you use to access the UI ?
Google Chrome
Other
This issue seems to be related to this previous bug: https://github.com/Comfy-Org/ComfyUI_frontend/issues/676.
This also applies to Primitive nodes. It's caused by LiteGraph's default behaviour - shrink nodes to to the "right" size whenever a widget is added (iirc, it just calls computeSize + setSize).
As undo reloads the workflow, this also triggers it. I wrote a quick and ugly workaround, so never bothered fixing it properly:
const addWidget = LGraphNode.prototype.addWidget
LGraphNode.prototype.addWidget = function (type, name, value, callback, options) {
const size = this.size
const w = addWidget.apply(this, arguments)
if (size) {
size[0] = Math.max(size[0], this.size[0])
size[1] = Math.max(size[1], this.size[1])
}
this.setSize(size)
return w
}
Not a solution - it introduces its own annoying behaviour.
This should now be resolved - please do reply if there is still an issue with this.