Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/app-core/src/components/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,15 @@ export const Preview = memo(function Preview({
} catch {
/* render errors are surfaced inline per block */
}
await renderDiagrams(stage, { themeKey: effectiveMode, expanded: false });
if (cancelled) return;
// Attach to the live document BEFORE rendering diagrams. JSXGraph binds to
// a real element via document.getElementById and sizes the board from the
// laid-out container, so a detached buffer yields "HTML container element
// not found" and zero-size boards (#68). Mermaid renders to inline SVG, so
// it is safe to render in the detached buffer above.
root.replaceChildren(...Array.from(stage.childNodes));
await renderDiagrams(root, { themeKey: effectiveMode, expanded: false });
if (cancelled) return;
requestAnimationFrame(() => {
if (!cancelled) onRenderedRef.current?.();
});
Expand Down
Loading