refactor(web): chat markdown images and videos live in their own module #22694
refactor/chat-markdown-links fromrefs/pull/22694/head·merged by juliusmarminge View on GitHubChatMarkdown.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
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
Approvability#
Verdict: Approved at
60af44fMacroscope'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
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).9b84cb8. Prior analysis still applies.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:
3 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check 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 checks: 3 passed-
Check name Status Explanation Title check The title clearly describes the primary change: moving chat Markdown image and video renderers into a separate module. Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check 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
Comment `@coderabbitai help` to get the list of available commands.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.
-
juliusmarminge merged this7ffc3bb
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes