ComfyUI
ComfyUI copied to clipboard
Template with a node with forceInput='true' breaks ComfyUI
Steps to reproduce:
- clean ComfyUI install
- add a trivial node with forceInput=True
class IntToInt:
@classmethod
def INPUT_TYPES(cls):
return {"required": { "int": ( "INT", { "default": 0, "forceInput": True, }, ), } }
RETURN_TYPES = ("INT",)
FUNCTION = "int_to_int"
CATEGORY = "test"
def int_to_int(self, int):
return (int,)
NODE_CLASS_MAPPINGS = { "int to int" : IntToInt }
- add this node and a primitive
- Press 'Queue Prompt'
- Correct error message ("Prompt has no outputs") seen
- Select the two nodes and save them as a template
- Delete the two nodes
- Add them back as a template
- Press
Queue Prompt- No error message appears
- JS console shows infinite call stack
Diagnosis
When a template is added with a forceInput, hideWidget is called twice:
This causes
serializeValue to be replaced twice; the second time it is called origSerializeValue already points to the new serializeValue.
Fix
Check if a widget has already been hidden at the start of hideWidget by inserting:
function hideWidget(node, widget, suffix = "") {
if (widget.type?.startsWith(CONVERTED_TYPE) return;
Added PR #2767 as fix