Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions web/js/nodeFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand All @@ -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);
},
Expand Down