From 3c7ccc192e50adb576e69f117a58e719ed1a04d9 Mon Sep 17 00:00:00 2001 From: Faton Ramadani Date: Mon, 12 Aug 2024 16:06:13 +0200 Subject: [PATCH] feat(frontend): Support default branch for branch one --- .../src/lib/components/graph/graphBuilder.ts | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/graph/graphBuilder.ts b/frontend/src/lib/components/graph/graphBuilder.ts index 03100ba794..eb6cae9da5 100644 --- a/frontend/src/lib/components/graph/graphBuilder.ts +++ b/frontend/src/lib/components/graph/graphBuilder.ts @@ -255,6 +255,28 @@ export default function graphBuilder( } nodes.push(endNode) + // Add default branch + const defaultBranch = { + id: `${module.id}-default`, + data: { + offset: currentOffset, + label: 'Default', + id: module.id, + branchIndex: -1, + modules: module.value.default, + eventHandlers: eventHandlers, + ...extra + }, + position: { x: -1, y: -1 }, + type: 'branchOneStart' + } + + nodes.push(defaultBranch) + + addEdge(module.id, defaultBranch.id, { type: 'empty' }) + + processModules(module.value.default, defaultBranch, endNode) + module.value.branches.forEach((branch, branchIndex) => { // Start node by branch @@ -275,7 +297,7 @@ export default function graphBuilder( nodes.push(startNode) - addEdge(module.id, startNode.id) + addEdge(module.id, startNode.id, { type: 'empty' }) processModules(branch.modules, startNode, endNode) })