Skip to content

refactor(ui): colocate api-reference components into _components/ - #32690

Closed
ryan-crabbe-berri wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_colocate_api_reference
Closed

refactor(ui): colocate api-reference components into _components/#32690
ryan-crabbe-berri wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_colocate_api_reference

Conversation

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Pure file relocation with no behavior change, so the proof is that the affected pages still render and the shared component still works everywhere it is used. On a live proxy, load each and screenshot:

  1. http://localhost:4000/ui/api-reference renders the API Reference tabs, and clicking a snippet's copy button still copies (that button is CodeBlock, the component that moved to @/components)
  2. http://localhost:4000/ui/cost-tracking "How it works" section still renders its code block
  3. http://localhost:4000/ui/playground agent builder view still renders its code block

Local checks: npx vitest run on the two affected suites (APIReferenceView, cost-tracking how_it_works) pass, npm run build compiles every route, and make pre-commit passes.

Type

🧹 Refactoring

Changes

This is the first colocation cleanup after the App Router migration closeout (#32576). It sets the convention for the remaining ~28 segments: a page's owned components live in <segment>/_components/ (private to the segment, matching Next's _ route-exclusion), and components imported by more than one segment stay in the shared @/components home instead of living inside one segment's folder

For api-reference specifically, APIReferenceView and DocLink are only used by api-reference, so they move into api-reference/_components/. CodeBlock is also imported by playground and cost-tracking, which makes it shared rather than api-reference-owned, so it moves to @/components/CodeBlock and the three external importers are repointed there. No logic changes; only file locations and import paths

The grandfathered @tremor/react suppression on APIReferenceView is re-keyed to the file's new path (the suppression count is unchanged, just moved). Converting that view off tremor is a separate effort and out of scope for a file move

First of the colocation follow-ups after the App Router migration closeout.
Establishes the convention for the remaining ~28 segments: a page's owned
components move into `<segment>/_components/` (private), and components shared
across segments move to the shared `@/components` home rather than sitting in
one segment's folder.

For api-reference:
- `APIReferenceView` and `DocLink` are api-reference-only, so they move into
  `api-reference/_components/`
- `CodeBlock` is imported by playground and cost-tracking too, so it is not
  api-reference-owned; it moves to `@/components/CodeBlock` and the three
  external importers are repointed there

No behavior change; pure file relocation plus import updates. The grandfathered
`@tremor/react` suppression on `APIReferenceView` is re-keyed to its new path
(converting that view off tremor is a separate effort, out of scope for a move).
@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR colocates UI components for the api-reference segment by moving APIReferenceView and DocLink into api-reference/_components/ (private to the segment) and promoting CodeBlock to the shared src/components/ directory since it is also consumed by cost-tracking and playground. All import paths, test mocks, and the ESLint suppression key are updated consistently; no logic changes are introduced.

  • CodeBlock moved to src/components/CodeBlock.tsx and all three consumers (APIReferenceView, how_it_works, AgentBuilderView) re-pointed to @/components/CodeBlock.
  • APIReferenceView and DocLink moved into api-reference/_components/; the page entry-point and the ESLint suppressions file updated to match.
  • A grep across the entire src/ tree confirms no stale imports remain on the old paths.

Confidence Score: 5/5

Pure file-relocation refactor with no logic changes; all import paths, test mocks, and the ESLint suppression key are updated and consistent.

Every changed line is an import path or a file rename. A grep across the full src/ tree confirms no consumer still references the old locations, and the test mock paths are aligned with the production imports they shadow.

No files require special attention.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/CodeBlock.tsx Pure file move from api-reference/components/ to the shared src/components/ directory; no content changes.
ui/litellm-dashboard/src/app/(dashboard)/api-reference/_components/APIReferenceView.tsx Moved from api-reference root into _components/; two import paths updated to @/components/CodeBlock and ./DocLink. No logic changes.
ui/litellm-dashboard/src/app/(dashboard)/api-reference/_components/APIReferenceView.test.tsx Moved alongside its subject; mock path updated from ./components/CodeBlock to @/components/CodeBlock to match the shared location.
ui/litellm-dashboard/src/app/(dashboard)/api-reference/page.tsx Import of APIReferenceView updated to ./_components/APIReferenceView; no other changes.
ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/components/how_it_works.tsx CodeBlock import repointed from the old api-reference-local path to @/components/CodeBlock; no logic changes.
ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/AgentBuilderView.tsx Single-line import update for CodeBlock; no logic or behaviour changes.
ui/litellm-dashboard/eslint-suppressions.json Suppression key re-keyed from the old APIReferenceView path to the new _components/ path; suppression count unchanged.

Reviews (1): Last reviewed commit: "refactor(ui): colocate api-reference com..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_colocate_api_reference (223e0e2) with litellm_internal_staging (1fa2001)

Open in CodSpeed

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

Superseded by #32704, which combines all four colocation batches into one PR per request. Same commits, cherry-picked onto one branch; branch kept for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant