From 32ad1c9b4d30ce4d2105c358c09642c75bd29db8 Mon Sep 17 00:00:00 2001 From: Olivier van Helden Date: Wed, 25 Mar 2026 17:23:06 -0400 Subject: [PATCH] fix(nodeFinder): follow execution and show executing node inside subgraphs Previously, both 'Follow execution' and 'Show executing node' would fail silently when the executing node was inside a subgraph. Root cause: subgraph node IDs are formatted as 'parentId:nodeId' (e.g. '5988:5982'), which app.graph.getNodeById() cannot resolve. Additionally, app.graph always refers to the root graph, even when the canvas is displaying a subgraph. Fix: - Split the composite ID and try each part as a candidate node ID - Search in app.canvas.graph first (the currently displayed graph, which may be a subgraph), then fall back to app.graph (root graph) This covers two scenarios: - Viewing the root graph: centers on the subgraph node that contains the executing node - Viewing inside a subgraph: centers on the executing node directly --- web/js/nodeFinder.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/web/js/nodeFinder.js b/web/js/nodeFinder.js index d372772..ae50575 100644 --- a/web/js/nodeFinder.js +++ b/web/js/nodeFinder.js @@ -12,7 +12,16 @@ app.registerExtension({ const centerNode = (id) => { if (!followExecution || !id) return; - const node = app.graph.getNodeById(id); + // Subgraph node IDs are formatted as "parentId:nodeId" + // Try the canvas's current graph first (may be a subgraph), then root graph + const parts = String(id).split(":"); + const graphs = [app.canvas.graph, app.graph].filter(Boolean); + const candidates = [id, parts[0], parts[parts.length - 1]]; + let node = null; + for (const graph of graphs) { + node = candidates.reduce((found, cid) => found || graph.getNodeById(cid), null); + if (node) break; + } if (!node) return; app.canvas.centerOnNode(node); }; @@ -35,7 +44,15 @@ app.registerExtension({ options.push({ content: "Show executing node", callback: () => { - const node = app.graph.getNodeById(app.runningNodeId); + const id = app.runningNodeId; + const parts = String(id).split(":"); + const graphs = [app.canvas.graph, app.graph].filter(Boolean); + const candidates = [id, parts[0], parts[parts.length - 1]]; + let node = null; + for (const graph of graphs) { + node = candidates.reduce((found, cid) => found || graph.getNodeById(cid), null); + if (node) break; + } if (!node) return; app.canvas.centerOnNode(node); },