From a35e62db14fe9f24579c8ae8f1f2bba7c359a7a9 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Thu, 20 Jun 2024 11:03:09 +0200 Subject: [PATCH] #5237 Fix for issue with setting up data for subgraphs --- packages/mermaid/src/diagrams/flowchart/flowDb.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/mermaid/src/diagrams/flowchart/flowDb.ts b/packages/mermaid/src/diagrams/flowchart/flowDb.ts index 66c852a14..a0beeaa8c 100644 --- a/packages/mermaid/src/diagrams/flowchart/flowDb.ts +++ b/packages/mermaid/src/diagrams/flowchart/flowDb.ts @@ -843,10 +843,10 @@ export const getData = () => { const edges: Edge[] = []; const subGraphs = getSubGraphs(); - log.info('Subgraphs - APA12', subGraphs); const parentDB = new Map(); const subGraphDB = new Map(); + // Setup the subgraph data for adding nodes for (let i = subGraphs.length - 1; i >= 0; i--) { const subGraph = subGraphs[i]; if (subGraph.nodes.length > 0) { @@ -855,6 +855,11 @@ export const getData = () => { subGraph.nodes.forEach((id) => { parentDB.set(id, subGraph.id); }); + } + + // Data is setup, add the nodes + for (let i = subGraphs.length - 1; i >= 0; i--) { + const subGraph = subGraphs[i]; nodes.push({ id: subGraph.id, label: subGraph.title,