refactor(ui): colocate api-reference components into _components/ - #32690
refactor(ui): colocate api-reference components into _components/#32690ryan-crabbe-berri wants to merge 1 commit into
Conversation
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 SummaryThis PR colocates UI components for the
Confidence Score: 5/5Pure 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.
|
| 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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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. |
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito 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:
http://localhost:4000/ui/api-referencerenders the API Reference tabs, and clicking a snippet's copy button still copies (that button isCodeBlock, the component that moved to@/components)http://localhost:4000/ui/cost-tracking"How it works" section still renders its code blockhttp://localhost:4000/ui/playgroundagent builder view still renders its code blockLocal checks:
npx vitest runon the two affected suites (APIReferenceView, cost-tracking how_it_works) pass,npm run buildcompiles every route, andmake pre-commitpasses.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@/componentshome instead of living inside one segment's folderFor api-reference specifically,
APIReferenceViewandDocLinkare only used by api-reference, so they move intoapi-reference/_components/.CodeBlockis also imported by playground and cost-tracking, which makes it shared rather than api-reference-owned, so it moves to@/components/CodeBlockand the three external importers are repointed there. No logic changes; only file locations and import pathsThe grandfathered
@tremor/reactsuppression onAPIReferenceViewis 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