refactor(web): chat markdown images and videos live in their own module#22694
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.
The image, video and asset-image renderers move to chat/ChatMarkdownMedia.tsx, along with their fallbacks, sizing helpers and the in-link context. MessagesTimeline and V2ItemInspector now import ChatMarkdownAssetImage from there.
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 | 2068 | 1626 |
| New files | chat/ChatMarkdownMedia.tsx (466) | |
| 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
- Successful
Skipped - Not affected
- Skipped
- Skipped
- Skipped
- SuccessfulRemove preview downloadGitHub
- SuccessfulCheckGitHub
- SkippedRelease SmokeGitHub
- SkippedRustGitHub
- Skipped
- SuccessfulBuild and TypecheckGitHub
- SuccessfulTest WebGitHub
- SuccessfulTestGitHub
- Skipped
- SuccessfulLabel PR sizeGitHub
- SuccessfulLabel PR 22694GitHub
- SuccessfulPrepare PR size configGitHub
- SuccessfulCollect PR targetsGitHub
- SuccessfulTest Server 6GitHub
- SuccessfulTest Server 8GitHub
- SuccessfulTest Server 3GitHub
- SuccessfulTest Server 5GitHub
- SuccessfulTest Server 4GitHub
- SuccessfulTest Server 1GitHub
- SuccessfulTest Server 7GitHub
- SuccessfulTest Server 2GitHub
- SuccessfulChangesGitHub
- SuccessfulLintGitHub
- SuccessfulNative fingerprint diffGitHub
- SuccessfulCheckGitHub
- SkippedRelease SmokeGitHub
- SkippedRustGitHub
- Skipped
- SuccessfulTest WebGitHub
- SuccessfulBuild and TypecheckGitHub
- SuccessfulTestGitHub
- SuccessfulTest Server 8GitHub
- SuccessfulTest Server 4GitHub
- SuccessfulTest Server 2GitHub
- SuccessfulTest Server 1GitHub
- SuccessfulTest Server 6GitHub
- SuccessfulLintGitHub
- SuccessfulTest Server 3GitHub
- SuccessfulTest Server 7GitHub
- SuccessfulTest Server 5GitHub
- SuccessfulChangesGitHub
- SuccessfulLabel PR 22694GitHub
- Skipped
- CancelledLabel PR 22694GitHub
- SuccessfulLabel PR sizeGitHub
- Skipped
- CancelledLabel PR sizeGitHub
- FailedCheckGitHub
- CancelledTest WebGitHub
- Cancelled
- CancelledBuild and TypecheckGitHub
- CancelledRustGitHub
- CancelledTestGitHub
- CancelledRelease SmokeGitHub
- SuccessfulNative fingerprint diffGitHub
- SkippedDeploy web previewGitHub
- SkippedEAS PreviewGitHub
- Skipped
- SkippedEAS PreviewGitHub
- SkippedDeploy web previewGitHub
- CancelledTest Server 2GitHub
- CancelledTest Server 7GitHub
- CancelledTest Server 8GitHub
- CancelledTest Server 6GitHub
- CancelledNative fingerprint diffGitHub
- CancelledTest Server 3GitHub
- CancelledTest Server 4GitHub
- CancelledChangesGitHub
- CancelledTest Server 1GitHub
- CancelledTest Server 5GitHub
- CancelledLintGitHub
- SuccessfulPrepare PR size configGitHub
- SuccessfulCollect PR targetsGitHub
- Skipped
- SuccessfulPrepare PR size configGitHub
- Skipped
- SuccessfulCollect PR targetsGitHub
Approvability
Verdict: Approved at 60af44f
Macroscope's review found this PR approvable — This PR moves the existing chat markdown image/video implementation into a dedicated module and updates its internal consumers. The media rendering, asset loading, actions, and stateful behavior remain substantively unchanged.
No code changes detected at 9b84cb8. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
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:
9e8085d6-a024-4cf6-b7ab-10ec15a86e75
📥 Commits
Reviewing files that changed from the base of the PR and between 60af44f4a2a3106a0df8c63ffb6ea99073ab63f6 and 9b84cb8097645f14d8b7163ee7a6ba0d608f79d9.
📒 Files selected for processing: 1
apps/web/src/components/chat/TimelineWorkEntryRow.tsx
Limit details: You’ve used all 10 included reviews currently available.
📝 Walkthrough
Media rendering and asset handling moved from
ChatMarkdown.tsxintoChatMarkdownMedia.tsx.ChatMarkdownand two other components now import media components from the dedicated module.Changes: Chat Markdown media
Layer / File(s) Summary Image and video rendering
apps/web/src/components/chat/ChatMarkdownMedia.tsxThe new module defines image and video renderers, image sizing and expansion, loading states, unavailable-media fallbacks, and media actions. Asset resolution and actions
apps/web/src/components/chat/ChatMarkdownMedia.tsxThe module handles asset URL refresh, resource references, fallback sources, and file-opening actions. Module extraction and consumer imports
apps/web/src/components/ChatMarkdown.tsx,apps/web/src/components/chat/ChatMarkdownMedia.tsx,apps/web/src/components/chat/V2ItemInspector.tsx,apps/web/src/components/chat/TimelineWorkEntryRow.tsxChatMarkdown.tsxnow imports media components fromChatMarkdownMedia.tsxinstead of defining them locally.V2ItemInspector.tsxandTimelineWorkEntryRow.tsximportChatMarkdownAssetImagefrom the new module.Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Refactor
Merge Risk: ⚪ Minimal · up to 9b84c
No concrete current-head regression or unresolved merge risk was identified.
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, preserved behavior, affected files, and verification results. It does not include the required Scope and approval section or link an issue or maintainer approval… Add the Scope and approval section with the triaged issue or explicit maintainer approval, including the approval comment. Add before/after UI screenshots, or state why screenshots are not applicable because the refactor preserves rendering… Passed Passed checks: 3 passed
Check name Status Explanation Title check Passed The title clearly describes the primary change: moving chat Markdown image and video renderers into a separate module. 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, preserved behavior, affected files, and verification results. It does not include the required Scope and approval section or link an issue or maintainer approval, and it does not provide UI screenshots or explain why they are not needed.
Resolution
Add the Scope and approval section with the triaged issue or explicit maintainer approval, including the approval comment. Add before/after UI screenshots, or state why screenshots are not applicable because the refactor preserves rendering behavior and boundaries.
✨ Finishing Touches: 💡 1
-
🛠️ Fix failing CI checks: 💡
- Commit to this branch
- Create a new PR
📝 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
Usage-based review receipt
- Mode: Continue automatically
- Reviewed files: 1
- Charged: $0.25
- View usage details
Note
This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
Comment @coderabbitai help to get the list of available commands.
Added 1 commit
- refactor(web): chat markdown images and videos live in their own module9b84cb8
Thread transfer impact
⚠️ The latest CI run did not produce a thread transfer result for 9b84cb8.
This comment will update automatically after the next completed run.