Skip to content
Source
Sign inSign up
pingdotgg/t3code

refactor(web): chat markdown images and videos live in their own module #22694

Mergedjuliusmarmingemerged 1 commit intorefactor/chat-markdown-links fromrefs/pull/22694/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

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.

BeforeAfter
ChatMarkdown.tsx lines20681626
New fileschat/ChatMarkdownMedia.tsx (466)
Rendersunchanged: no component, subscription or context boundary movedunchanged

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.ts for every touched file (0 bailouts)
  • tsc --noEmit for apps/web, and vp lint on changed files

🤖 Generated with Claude Code

    1. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      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.tsx into ChatMarkdownMedia.tsx. ChatMarkdown and 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.tsx
      The 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.tsx
      The 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.tsx
      ChatMarkdown.tsx now imports media components from ChatMarkdownMedia.tsx instead of defining them locally. V2ItemInspector.tsx and TimelineWorkEntryRow.tsx import ChatMarkdownAssetImage from 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 nameStatusExplanationResolution
      Description checkWarningThe 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 nameStatusExplanation
      Title checkPassedThe title clearly describes the primary change: moving chat Markdown image and video renderers into a separate module.
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck 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

      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.
    3. 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.

    4. juliusmarminge merged this7ffc3bb

    5. juliusmarminge closed this

Sign in to join this conversation.