From aff1e3936a327517ca1bae5c3f44e8ef497f0bcd Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Thu, 16 Mar 2023 19:15:02 +0000 Subject: [PATCH] Simplify and fix bug with following virtual nodes courtesy of someanon --- web/scripts/app.js | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/web/scripts/app.js b/web/scripts/app.js index e70e1c15..b780bd83 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) {