Skip to content

Build your personal knowledge base with Trilium Notes

chore(mermaid): avoid crash if "Matrix is not invertible"

Elian Doran6946da357185
diff --git a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx
index 8a9e64a24a..7f95bfb1b6 100644
--- a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx
+++ b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx
@@ -163,7 +163,12 @@ function useResizer(containerRef: RefObject<HTMLDivElement>, noteId: string, svg
pan: zoomInstance.getPan(),
zoom: zoomInstance.getZoom()
}
- zoomInstance.destroy();
+ try {
+ zoomInstance.destroy();
+ } catch (e) {
+ // Sometimes crashes with "Matrix is not invertible" which can cause havoc such as breaking the popup editor from ever showing up again.
+ console.warn(e);
+ }
};
}, [ svg ]);