diff --git a/packages/mermaid/src/diagrams/class/classDb.ts b/packages/mermaid/src/diagrams/class/classDb.ts index e15103469a..f4a5829d90 100644 --- a/packages/mermaid/src/diagrams/class/classDb.ts +++ b/packages/mermaid/src/diagrams/class/classDb.ts @@ -629,9 +629,7 @@ export const getData = () => { } } - let cnt = 0; - for (const note of notes) { - cnt++; + for (const note of notes.values()) { const noteNode: Node = { id: note.id, label: note.text, @@ -645,14 +643,15 @@ export const getData = () => { `stroke: ${config.themeVariables.noteBorderColor}`, ], look: config.look, + parentId: note.parent, }; nodes.push(noteNode); - const noteClassId = classes.get(note.class)?.id ?? ''; + const noteClassId = classes.get(note.class)?.id; if (noteClassId) { const edge: Edge = { - id: `edgeNote${cnt}`, + id: `edgeNote${note.index}`, start: note.id, end: noteClassId, type: 'normal', @@ -682,7 +681,7 @@ export const getData = () => { nodes.push(interfaceNode); } - cnt = 0; + let cnt = 0; for (const classRelation of relations) { cnt++; const edge: Edge = {