ComfyUI_frontend
ComfyUI_frontend copied to clipboard
[Bug]: Hidden upload image button gets triggered when clicking on unrelated save button in mask editor
Frontend Version
v1.2.62
Expected Behavior
When creating a group node containing an image, and hiding the upload image button as follows:
Clicking on
Save to node
button in the mask editor should simply save the mask to the node and no nothing else.
Actual Behavior
Clicking on Save to node
also triggers the hidden upload image button.
Steps to Reproduce
Create a group node with an image, hide upload button, edit mask, save mask and the open file dialog should appear.
Debug Logs
N/A
Browser Logs
This is caused by line 328 in src/ui/app.ts, where we can read: if (prop && prop.type != 'button') {
.
Normally, when the upload image button is not hidden,
prop.type
takes the value 'button'
, and thus the potential prop.callback(value)
on line 345 is never reached.
But when the upload image button is hidden, prop.type
takes the value 'hidden'
as shown in the picture. Then line 345 is reached.
Basically, hiding a widget causes the UI to forget its type, because prop.type
serves two purposes right now instead of a single one. Hence the confusion.
The proper fix consist in introducing a new boolean parameter hidden
that controls whether a widget is hidden or not.
The improper but easy fix consist in adding a condition on line 328: !(prop.type == 'hidden' && prop.name == 'upload' && prop.value == 'image')
.
What browsers do you use to access the UI ?
Microsoft Edge
Other
No response