From 39dd411481d450b1cdb92ddba3a8b613ddd2218a Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 28 Jul 2026 20:37:22 +0200 Subject: [PATCH] fix(frontend): add the preprocessor node before the error handler markers (#10395) --- .../components/graph/graphBuilder.svelte.ts | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/lib/components/graph/graphBuilder.svelte.ts b/frontend/src/lib/components/graph/graphBuilder.svelte.ts index aefe57da68..3e56a5cd5b 100644 --- a/frontend/src/lib/components/graph/graphBuilder.svelte.ts +++ b/frontend/src/lib/components/graph/graphBuilder.svelte.ts @@ -403,9 +403,12 @@ export function topologicalSort( visited.add(id) // A parent id with no node is a bug in whoever built the graph, but the whole editor - // unmounts if this throws, so skip it and let the rest of the graph render. + // unmounts if this throws, so warn and let the rest of the graph render. const node = nodeMap.get(id) - if (!node) return + if (!node) { + console.warn('Edge to a node that does not exist: ', id) + return + } node.parentIds?.forEach(visit) result.push(node) } @@ -1234,6 +1237,14 @@ export function graphBuilder( processModules(topLevelItems, undefined, inputNode, resultNode, false, undefined) } + // Before the failure markers: the preprocessor can be the step that failed, and a marker is + // only anchored to a step already present in `nodes`. + if (preprocessorModule) { + addNode(preprocessorModule) + const id = JSON.parse(JSON.stringify(preprocessorModule.id)) + addEdge(id, 'Input', undefined, undefined, { type: 'empty' }) + } + if (failureModule) { // Keyed by failing step, so a step that failed several times (loop iterations each run // their own handler, with ids like `failure-0-1`) gets one marker, not a stack of them. @@ -1259,12 +1270,6 @@ export function graphBuilder( }) } - if (preprocessorModule) { - addNode(preprocessorModule) - const id = JSON.parse(JSON.stringify(preprocessorModule.id)) - addEdge(id, 'Input', undefined, undefined, { type: 'empty' }) - } - if (failureModule && !extra.flowModuleStates) { addFailureNode(failureModule) }