v3.5.2
What's Changed
Bug Fixes
- Fix
Cannot read properties of undefined (reading 'getBBox')and intermittent hydration failures in mermaid code blocks on Next.js static-export sites by @linyows in #218- Disable mermaid's auto-render with
mermaid.startOnLoad = falseso the library no longer mutates the DOM (and inserts its temporary<div id=\"dmermaid-...\">workspace) before React hydration runs - Switch from
mermaid.run()tomermaid.render(id, source)and inject the returned SVG string viauseState+dangerouslySetInnerHTML, keeping the rendered DOM under React's control - Capture the original diagram source once into
sourceRefso re-runs (Strict Mode, HMR, language change) do not re-parse an already-replaced node - Skip
mermaid.renderwhenmermaidSvgis already populated, removing the race that produced duplicated{id}workspace divs andFailed to execute 'removeChild' on 'Node'errors - Use distinct keys on the source vs rendered
<pre>so React unmount → mount instead of reconciling differing children - Pin
securityLevel: 'strict'explicitly inmermaid.initialize(matches mermaid v11's default but documents the XSS posture for diagram source coming from Notion)
- Disable mermaid's auto-render with
Full Changelog: v3.5.1...v3.5.2