Comfy-Org / Comfy-Org/ComfyUI

IS_CHANGED method ignored in cases where inputs change

Open
#8,406 0 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Custom Node Testing

- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

The docs for IS_CHANGED suggest it can be used when you need to "sometimes ignores inputs (so doesn’t need to execute just because those inputs changed)". However, it seems it's always triggered if the inputs change, regardless of the IS_CHANGED method.

Take, for example this simple test node:

```
class NeverChanged:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {"image_in": ("IMAGE",)},
}

RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image_out",)
FUNCTION = "process"
CATEGORY = "Test"

@classmethod
def IS_CHANGED(cls, image_in):
return "never"

def process(self, image_in):
import time

print("process() triggered")
time.sleep(5)

return (torch.zeros_like(image_in),)
```

If I wire this up to a `Webcam Capture` -> `NeverChanged` -> `Image Preview`, I see that the process() method is triggered everysingle iteration.

### Actual Behavior

In the above example, I see both in the logs that process() is triggered every call, and I see in the UI that it's pausing for the 5 seconds sleep there.

### Steps to Reproduce

[IS_CHANGED_test.json](https://github.com/user-attachments/files/20573435/IS_CHANGED_test.json)

### Debug Logs

```powershell
N/A
```

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.