Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
MermaidBlockkeeps the SVG host mounted — the error branch no longer returns early and unmounts the container. The host<div>stays mounted buthidden={error !== null}, andsetError(null)is now reached even when the host had been empty, so a later successfulmermaid.render()clears the stale error.- Error path clears the host — on a syntax error the catch branch wipes
containerRef.current.innerHTMLso a previously rendered SVG can't linger behind the hidden host. - Regression test — a new happy-dom test file covers error display, error→valid recovery without remount, and valid→error re-failure. The middle case genuinely fails against the old guard (
setError(null)was previously insideif (!cancelled && containerRef.current), so a null ref blocked recovery).
The fix is well-scoped: the wrapper .mermaid-block class move is inert for existing descendant CSS (.mermaid-block svg, [&_.mermaid-block_pre]), the hidden attribute behaves correctly with no author CSS overriding the inner host, and the renderer stays local (no SSH/wire surface touched).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Extend Wooseong Kim’s #18449 recovery coverage with delayed success/error, unmount, and empty parser error controls. Keep the current formatted-label sanitizer when adopting the original change.
Keep the SVG host mounted while a diagram error is shown so a later successful parse can write the diagram and clear the stale error without toggling code/edit mode. Fixes stablyai#18370
2fc1c7c to
3f2a3aa
Compare
|
Thanks @innocarpe for the clear diagnosis of the null SVG host after a parse failure! This is already fixed on main by #26480 (79a8cff): |

Description
Fixing a Mermaid syntax error in floating-window markdown now re-renders the diagram without toggling code/edit mode.
After a parse failure the error UI replaced the SVG host, so a later successful
mermaid.render()found a null ref and never cleared the stale error.Focused fix
Preserves
htmlLabelsinitialization are unchanged.Evidence
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/editor/MermaidBlock.test.tsxUser-regression-tradeoffs
Fixes #18370