Skip to content
Source
Sign inSign up
pingdotgg/t3code

refactor(web): chat markdown links and file chips live in their own modules #22693

Mergedjuliusmarmingemerged 1 commit intorefactor/chat-markdown-tables fromrefs/pull/22693/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 file-link chip moves to chat/MarkdownFileLink.tsx, and its pure action helpers to MarkdownFileLink.logic.ts. External-link favicons and URL wrapping move to chat/MarkdownExternalLink.tsx. Same-document fragment clicks and heading ids move to chat/markdownFragments.ts, and the hast text helpers to chat/markdownHast.logic.ts.

This is a pure move. Each renderer was already its own component, so no render boundary changes. Behavior is unchanged.

BeforeAfter
ChatMarkdown.tsx lines27762068
New fileschat/MarkdownFileLink.tsx (411), MarkdownFileLink.logic.ts (62), MarkdownExternalLink.tsx (110), markdownFragments.ts (113), markdownHast.logic.ts (42)
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 717a53e

      Macroscope's review found this PR approvable — This refactor moves existing markdown link, file-chip, fragment, and HAST-rendering code into focused modules without changing call sites, props, or behavior. The large diff is primarily deletion and re-addition from relocating code, with no product-default, schema, configuration-suppression, or sensitive-area changes.

      No code changes detected at e113e20. 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 →

      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: cd850f14-9123-4f43-89de-f4d8f6d8ce03
      📥 Commits

      Reviewing files that changed from the base of the PR and between 717a53e868d8965865b6e89fc26c8a6519163f73 and e113e20a3ef097439956f98e500d23e65581c354.

      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: be9c83cb-aaf8-4797-8c3b-16ae81211edd
      📥 Commits

      Reviewing files that changed from the base of the PR and between deaa44462acc287c5960b75def7307bdc4ef3615 and 717a53e868d8965865b6e89fc26c8a6519163f73.

      📒 Files selected for processing: 6
      • apps/web/src/components/ChatMarkdown.tsx
      • apps/web/src/components/chat/MarkdownExternalLink.tsx
      • apps/web/src/components/chat/MarkdownFileLink.logic.ts
      • apps/web/src/components/chat/MarkdownFileLink.tsx
      • apps/web/src/components/chat/markdownFragments.ts
      • apps/web/src/components/chat/markdownHast.logic.ts

      Limit details: You’ve used all 10 included reviews currently available.

      📝 Walkthrough

      Markdown link rendering, file actions, fragment navigation, and HAST text utilities now reside in dedicated modules. ChatMarkdown.tsx imports these modules instead of defining their implementations locally.

      Changes: Markdown rendering components

      Layer / File(s)Summary
      File-link actions and rendering
      apps/web/src/components/chat/MarkdownFileLink.logic.ts, apps/web/src/components/chat/MarkdownFileLink.tsx
      File-link logic selects available actions and builds copy-menu items. The component handles previews, editor and browser opening, file reveal, copying, context menus, and action feedback.
      External-link rendering and HAST text
      apps/web/src/components/chat/MarkdownExternalLink.tsx, apps/web/src/components/chat/markdownHast.logic.ts
      External links render a host icon or fallback, with break opportunities in link text. HAST utilities extract direct or descendant text and detect non-whitespace text.
      Fragment navigation and heading IDs
      apps/web/src/components/chat/markdownFragments.ts
      Fragment clicks resolve a target and scroll it into view. The rehype plugin assigns unique, prefixed IDs to headings without IDs.
      ChatMarkdown integration
      apps/web/src/components/ChatMarkdown.tsx
      ChatMarkdown.tsx imports the extracted modules and removes the local implementations and exported file-link action helpers.

      Priority: ⬇️ Low

      Estimated code review effort: 3 (Moderate) | ~25 minutes

      Change: Refactor

      Merge Risk: ⚪ Minimal · up to 717a5

      This refactor moves markdown link and fragment code into separate modules without changing behavior. No actionable merge-blocking risk was identified.

      Pre-merge checks: Passed 3 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Description checkWarningThe description explains the refactor and lists verification results, but it does not follow the required section structure. It omits the Problem, Change, and Scope and approval headings, provides no …Restructure the description using the required Problem, Change, Scope and approval, and Verification headings. Add the linked issue or explicit maintainer approval, include before and after screenshots if this qualifies as a UI change, and …
      Passed Passed checks: 3 passed
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main change: moving chat Markdown links and file chips into separate modules.
      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 and lists verification results, but it does not follow the required section structure. It omits the Problem, Change, and Scope and approval headings, provides no issue or maintainer approval reference, and does not include required UI screenshots or a complete model and harness attribution.

      Resolution

      Restructure the description using the required Problem, Change, Scope and approval, and Verification headings. Add the linked issue or explicit maintainer approval, include before and after screenshots if this qualifies as a UI change, and identify the model and harness used by the agent.

      ✨ 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.
    3. Thread transfer impact

      ⚠️ The latest CI run did not produce a thread transfer result for e113e20.

      This comment will update automatically after the next completed run.

    4. juliusmarminge merged this827f6d4

    5. juliusmarminge closed this

Sign in to join this conversation.