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

This commit is contained in:
Elian Doran 2025-11-22 21:07:17 +02:00
parent 2985c762e6
commit 6946da3571
No known key found for this signature in database

View File

@ -163,7 +163,12 @@ function useResizer(containerRef: RefObject<HTMLDivElement>, noteId: string, svg
pan: zoomInstance.getPan(), pan: zoomInstance.getPan(),
zoom: zoomInstance.getZoom() 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 ]); }, [ svg ]);