Skip to content

Commit

Permalink
sigh debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Donham committed Jun 24, 2022
1 parent 4c84e20 commit 0cb6f01
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/blocks/mermaid-block/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ mermaid.mermaidAPI.initialize({ startOnLoad: false });
export default function (props: FileBlockProps) {
const { content } = props;
const [rendered, setRendered] = React.useState("");
console.log("rendering mermaid block");

React.useEffect(() => {
mermaid.mermaidAPI.render("id", content, (rendered) =>
setRendered(rendered)
);
console.log("rendering mermaid", content);
mermaid.mermaidAPI.render("id", content, (rendered) => {
console.log("rendered mermaid");
setRendered(rendered);
});
}, [content]);

return <div id="mermaid" dangerouslySetInnerHTML={{ __html: rendered }} />;
Expand Down

0 comments on commit 0cb6f01

Please sign in to comment.