From 23dd7b2b100394afe68ddc8c161326e34f939833 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Wed, 14 Feb 2024 12:41:54 +0530 Subject: [PATCH] add name only when present in rectData --- packages/mermaid/src/diagrams/common/svgDrawCommon.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/mermaid/src/diagrams/common/svgDrawCommon.ts b/packages/mermaid/src/diagrams/common/svgDrawCommon.ts index 6bf445ecf7..cf962f33ec 100644 --- a/packages/mermaid/src/diagrams/common/svgDrawCommon.ts +++ b/packages/mermaid/src/diagrams/common/svgDrawCommon.ts @@ -21,7 +21,9 @@ export const drawRect = (element: SVG | Group, rectData: RectData): D3RectElemen rectElement.attr('stroke', rectData.stroke); rectElement.attr('width', rectData.width); rectElement.attr('height', rectData.height); - rectElement.attr('name', rectData.name); + if (rectData.name) { + rectElement.attr('name', rectData.name); + } rectData.rx !== undefined && rectElement.attr('rx', rectData.rx); rectData.ry !== undefined && rectElement.attr('ry', rectData.ry);