Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does the same node in a loop get different ids? #574

Open
QtumOne opened this issue Dec 12, 2024 · 1 comment
Open

Why does the same node in a loop get different ids? #574

QtumOne opened this issue Dec 12, 2024 · 1 comment

Comments

@QtumOne
Copy link

QtumOne commented Dec 12, 2024

Problem

Why does the smae node in a loop get different ids? in the first time it get a normal id: '123', while the second time get a different id: '456.0.0.3.0.0.123'?

Since most custom_nodes will use the id as a unique key to save data, if the id cannot be kept consistent, it may cause bugs. As we can see there are a lot of issues all caused by this reason.

Demo

demo

Here is a demo using image chooser in a for loop. This loop will run twice. In the first time the image chooser works fine, while in the second time, the image chooser cannot get the new generated image, and click the button, nothing happed, it just stucked there.

Drag the image into comfyui to test.

@QtumOne QtumOne changed the title Why done the same node in a loop get different id? Why does the same node in a loop get different id? Dec 12, 2024
@QtumOne QtumOne changed the title Why does the same node in a loop get different id? Why does the same node in a loop get different ids? Dec 12, 2024
@yolain
Copy link
Owner

yolain commented Dec 13, 2024

In short, this is derived from the subgraph logic in the comfy core, which gives nodes different IDs in each loop thus enabling looping.
So, it becomes cumbersome to solve the problem of inconsistent IDs, including an artful way to implement the output of leaf nodes in loops previously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants