From b7b05f4a5528ce0c2826cb49ea43419b97b8519b Mon Sep 17 00:00:00 2001 From: Anthony Juckel Date: Thu, 5 Jun 2025 08:47:23 -0500 Subject: [PATCH] wip: some nullability changes...? --- packages/mermaid/src/diagrams/flowchart/flowDb.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/mermaid/src/diagrams/flowchart/flowDb.ts b/packages/mermaid/src/diagrams/flowchart/flowDb.ts index a41466b09..2329f0ace 100644 --- a/packages/mermaid/src/diagrams/flowchart/flowDb.ts +++ b/packages/mermaid/src/diagrams/flowchart/flowDb.ts @@ -85,7 +85,7 @@ export class FlowDB implements DiagramDB { return common.sanitizeText(txt, this.config); } - private sanitizeNodeLabelType(labelType: string) { + private sanitizeNodeLabelType(labelType?: string) { switch (labelType) { case 'markdown': case 'string': @@ -219,7 +219,7 @@ export class FlowDB implements DiagramDB { if (doc?.label) { vertex.text = doc?.label; - vertex.labelType = this.sanitizeNodeLabelType(doc?.labelType ?? 'markdown'); + vertex.labelType = this.sanitizeNodeLabelType(doc?.labelType); } if (doc?.icon) { vertex.icon = doc?.icon; @@ -279,7 +279,7 @@ export class FlowDB implements DiagramDB { if (edge.text.startsWith('"') && edge.text.endsWith('"')) { edge.text = edge.text.substring(1, edge.text.length - 1); } - edge.labelType = linkTextObj.type; + edge.labelType = this.sanitizeNodeLabelType(linkTextObj.type); } if (type !== undefined) { @@ -714,7 +714,7 @@ You have to call mermaid.initialize.` title: title.trim(), classes: [], dir, - labelType: _title.type, + labelType: this.sanitizeNodeLabelType(_title?.type), }; log.info('Adding', subGraph.id, subGraph.nodes, subGraph.dir);