refactor(web): the Mermaid code block lives in its own component file#22691
ChatMarkdown.tsx was a 3,560-line file that held every markdown renderer. This stack splits it into focused modules so each piece is readable on its own.
MarkdownMermaidCodeBlock moves next to MermaidDiagram. That includes its diagram/source toggle and its find reveal. The ./chat/MermaidDiagram mock in ChatMarkdown.browser.test.tsx still applies, because it mocks by module path.
This is a pure move. Each renderer was already its own component, so no render boundary changes. Behavior is unchanged.
| Before | After | |
|---|---|---|
ChatMarkdown.tsx lines | 3069 | 2992 |
| New files | chat/MarkdownMermaidCodeBlock.tsx (84) | |
| Renders | unchanged: no component, subscription or context boundary moved | unchanged |
Renders were not measured for this layer. It changes no render boundaries: the components, their props, and the two contexts stay exactly as they were.
Tests run:
vp test run --project browser src/components/ChatMarkdown.browser.test.tsx src/components/ChatMarkdown.permissions.browser.test.tsx(11 passed)vp test run --project unit src/reactCompilerCoverage.test.tsfor every touched file (0 bailouts)tsc --noEmitfor apps/web, andvp linton changed files
🤖 Generated with Claude Code
Checks
- SuccessfulCodeRabbitGitHub
Review completed
- Skipped
- Skipped
- Skipped
- SuccessfulRemove preview downloadGitHub
- SuccessfulCheckGitHub
- SkippedRustGitHub
- Skipped
- SkippedRelease SmokeGitHub
- SuccessfulTestGitHub
- SuccessfulBuild and TypecheckGitHub
- SuccessfulTest WebGitHub
- SuccessfulLabel PR 22691GitHub
- Skipped
- SuccessfulLabel PR sizeGitHub
- SuccessfulCollect PR targetsGitHub
- SuccessfulPrepare PR size configGitHub
- SuccessfulTest Server 5GitHub
- SuccessfulTest Server 4GitHub
- SuccessfulTest Server 2GitHub
- SuccessfulTest Server 7GitHub
- SuccessfulTest Server 8GitHub
- SuccessfulTest Server 6GitHub
- SuccessfulChangesGitHub
- SuccessfulTest Server 1GitHub
- SuccessfulTest Server 3GitHub
- SuccessfulLintGitHub
- SuccessfulNative fingerprint diffGitHub
- SuccessfulCheckGitHub
- SkippedRustGitHub
- SkippedRelease SmokeGitHub
- Skipped
- SuccessfulTestGitHub
- SuccessfulTest WebGitHub
- SuccessfulBuild and TypecheckGitHub
- SuccessfulTest Server 2GitHub
- SuccessfulTest Server 3GitHub
- SuccessfulTest Server 6GitHub
- SuccessfulTest Server 4GitHub
- SuccessfulTest Server 7GitHub
- SuccessfulTest Server 8GitHub
- SuccessfulTest Server 1GitHub
- SuccessfulTest Server 5GitHub
- SuccessfulLintGitHub
- SuccessfulChangesGitHub
- SkippedEAS PreviewGitHub
- Skipped
- SuccessfulLabel PR sizeGitHub
- Skipped
- CancelledLabel PR sizeGitHub
- SuccessfulLabel PR 22691GitHub
- CancelledLabel PR 22691GitHub
- CancelledBuild and TypecheckGitHub
- CancelledRustGitHub
- CancelledRelease SmokeGitHub
- CancelledTest WebGitHub
- CancelledTestGitHub
- Cancelled
- FailedCheckGitHub
- Skipped
- SuccessfulNative fingerprint diffGitHub
- SkippedDeploy web previewGitHub
- SkippedEAS PreviewGitHub
- SkippedDeploy web previewGitHub
- CancelledTest Server 7GitHub
- CancelledTest Server 1GitHub
- CancelledTest Server 6GitHub
- CancelledTest Server 5GitHub
- CancelledTest Server 3GitHub
- CancelledTest Server 8GitHub
- CancelledTest Server 2GitHub
- CancelledLintGitHub
- CancelledTest Server 4GitHub
- CancelledChangesGitHub
- CancelledNative fingerprint diffGitHub
- SuccessfulCollect PR targetsGitHub
- SuccessfulPrepare PR size configGitHub
- Skipped
- Skipped
- SuccessfulCollect PR targetsGitHub
- SuccessfulPrepare PR size configGitHub
Approvability
Verdict: Approved at 8399708
Macroscope's review found this PR approvable — This PR moves the existing Mermaid code-block renderer into its own component file without changing its props, rendering logic, state, context, or user-facing behavior. The change is limited to module organization and import updates.
No code changes detected at 0a9ade9. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
Important
Review skipped
Review was skipped as selected files did not have any reviewable changes.
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
165bd3ea-805a-4a46-a541-83df8b4fa342
📥 Commits
Reviewing files that changed from the base of the PR and between 839970877ff9a3c68e52165a4443c776ff5993b7 and 0a9ade9156c9a9d199b97b3042b01213c23888cb.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
82a6a0ea-69c4-4bf7-8af9-ca81a261ddce
📥 Commits
Reviewing files that changed from the base of the PR and between 17911714648b1debf9d6d6fc4fea6c95bf86f83d and 839970877ff9a3c68e52165a4443c776ff5993b7.
📒 Files selected for processing: 2
apps/web/src/components/ChatMarkdown.tsxapps/web/src/components/chat/MarkdownMermaidCodeBlock.tsx
Limit details: You’ve used all 10 included reviews currently available.
📝 Walkthrough
The Mermaid code block component moved from
ChatMarkdown.tsxto a dedicated module.ChatMarkdown.tsximports the component for Mermaid rendering.Changes: Mermaid code block
Layer / File(s) Summary Extract and integrate Mermaid rendering
apps/web/src/components/chat/MarkdownMermaidCodeBlock.tsx,apps/web/src/components/ChatMarkdown.tsxThe new component handles diagram and source views, streaming, search-source visibility, suspense fallback, and rendering errors. ChatMarkdown.tsximports it and removes the local implementation and unused imports.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Suggested reviewers:
maria-rcks
Merge Risk: ⚪ Minimal · up to 83997
Mermaid rendering appears unchanged by this extraction; no merge-blocking issue remains after normal checks.
Pre-merge checks: Passed 3 · Failed 1
Failed Failed checks: 1 warning
Check name Status Explanation Resolution Description check Warning The description explains the refactor, unchanged behavior, affected files, and verification commands. It does not include the required Scope and approval section, and it does not explicitly explain wh… Add the required Problem, Change, Scope and approval, and Verification sections. In Scope and approval, link the relevant issue or maintainer approval, or explain why this focused refactor qualifies without one. In Verification, report the … Passed Passed checks: 3 passed
Check name Status Explanation Title check Passed The title clearly and concisely describes the main change: moving the Mermaid code block into its own component file. Linked Issues check Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description explains the refactor, unchanged behavior, affected files, and verification commands. It does not include the required Scope and approval section, and it does not explicitly explain why prior issue or maintainer approval was unnecessary. The verification section also does not state observed results for every listed check or address UI evidence requirements.
Resolution
Add the required Problem, Change, Scope and approval, and Verification sections. In Scope and approval, link the relevant issue or maintainer approval, or explain why this focused refactor qualifies without one. In Verification, report the observed results for TypeScript and lint checks and provide UI screenshots if required for this UI-related change.
✨ Finishing Touches
📝 Generate docstrings
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Added 1 commit
- refactor(web): the Mermaid code block lives in its own component file0a9ade9
Thread transfer impact
⚠️ The latest CI run did not produce a thread transfer result for 0a9ade9.
This comment will update automatically after the next completed run.