Skip to content

Suppress Mermaid render error artifacts#1286

Draft
codenem wants to merge 1 commit into
mainfrom
cursor/fix-mermaid-error-toast-4105
Draft

Suppress Mermaid render error artifacts#1286
codenem wants to merge 1 commit into
mainfrom
cursor/fix-mermaid-error-toast-4105

Conversation

@codenem

@codenem codenem commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a shared Mermaid renderer that enables suppressErrorRendering and cleans up Mermaid's fallback error node.
  • Route failed Mermaid renders through the product toast flow with a safe inline fallback instead of raw Mermaid error text.
  • Apply the same Mermaid error suppression to generated document HTML.

Validation

  • npm --workspace @probo/ui run lint
  • npm --workspace @probo/ui run check (fails on existing src/Foundation.stories.tsx(193,16) missing socialName, unrelated to this change)
  • make go-fmt

Notes

  • npm install was required in this cloud environment because dependencies were not installed; the local Node 22/npm 10 toolchain emitted an engine warning for the repo's Node 24/npm 11 requirement.

Linear Issue: ENG-438

Open in Web Open in Cursor 

Summary by cubic

Prevents raw mermaid error text from appearing in the editor, Markdown preview, and generated docs. Adds a shared renderer in @probo/ui that suppresses mermaid error nodes, shows a toast on failure, and falls back to safe inline content (ENG-438).

Package: ui +104 -28

  • Added shared renderMermaidDiagram helper that initializes mermaid with suppressErrorRendering and removes its fallback error node; exported mermaidRenderErrorToast.
  • Updated MermaidDiagram and rich editor MermaidNodeView to use the helper; on failure, show a toast and render a safe inline fallback instead of raw error text.

Service +1 -1

  • Updated docgen template to initialize mermaid with suppressErrorRendering so exported HTML never shows Mermaid’s error output.

Written for commit cc8c47f. Summary will update on new commits.

Review in cubic

Configure Mermaid to suppress its built-in error renderer in both
interactive UI previews and generated document HTML. Render failures now
surface through the product toast flow with a safe inline fallback instead
of leaving raw Mermaid diagnostics in the document body.

Signed-off-by: Cursor Agent <[email protected]>

Co-authored-by: Émile Ré <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants