Skip to content

Build your personal knowledge base with Trilium Notes

fix(mermaid): error when diagram is empty

Elian Doranda193b456bb0
diff --git a/apps/client/src/widgets/type_widgets/mermaid/Mermaid.tsx b/apps/client/src/widgets/type_widgets/mermaid/Mermaid.tsx
index 2d3c312283..eeda0be5ed 100644
--- a/apps/client/src/widgets/type_widgets/mermaid/Mermaid.tsx
+++ b/apps/client/src/widgets/type_widgets/mermaid/Mermaid.tsx
@@ -18,6 +18,10 @@ export default function Mermaid(props: TypeWidgetProps) {
registeredErrorReporter = true;
}
+ if (!content.trim()) {
+ return "";
+ }
+
mermaid.initialize({
startOnLoad: false,
...(getMermaidConfig() as any),