Template with a node with forceInput='true' breaks ComfyUI
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
# Steps to reproduce:
- clean ComfyUI install
- add a trivial node with forceInput=True
```python
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:
```javascript
function hideWidget(node, widget, suffix = "") {
if (widget.type?.startsWith(CONVERTED_TYPE) return;
```
Contributor guide
Assessment
This issue has not been assessed yet.