Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Simplify and fix bug with following virtual nodes courtesy of someanon

pythongosssssaff1e3936a32
diff --git a/web/scripts/app.js b/web/scripts/app.js
index e70e1c157..b780bd839 100644
--- a/web/scripts/app.js
+++ b/web/scripts/app.js
@@ -606,24 +606,10 @@ class ComfyApp {
for (let i in node.inputs) {
let parent = node.getInputNode(i);
if (parent) {
- let link;
- if (parent.isVirtualNode) {
- // Follow the path of virtual nodes until we reach the first real one
- while (parent != null) {
- link = parent.getInputLink(0);
- if (link) {
- const from = graph.getNodeById(link.origin_id);
- if (from.isVirtualNode) {
- parent = from;
- } else {
- parent = null;
- }
- } else {
- parent = null;
- }
- }
- } else {
- link = node.getInputLink(i);
+ let link = node.getInputLink(i);
+ while (parent && parent.isVirtualNode) {
+ link = parent.getInputLink(link.origin_slot);
+ parent = parent.getInputNode(link.origin_slot);
}
if (link) {