'use client'; import { useEffect, useRef } from 'react'; import mermaid from 'mermaid'; mermaid.initialize({ startOnLoad: false, theme: 'default', }); export function Mermaid({ chart }: { chart: string }) { const ref = useRef(null); useEffect(() => { if (ref.current) { mermaid.run({ nodes: [ref.current], }); } }, [chart]); return (
{chart}
); }