Skip to content

refactor(ui): colocate 11 route segments' components into _components/ - #32704

Merged
ryan-crabbe-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_colocate_all
Jul 10, 2026
Merged

refactor(ui): colocate 11 route segments' components into _components/#32704
ryan-crabbe-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_colocate_all

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 relocation with no behavior change; the proof is that each affected page still renders and shared dependencies still resolve. On a live proxy, load each and confirm it renders (and, where noted, that the interactive bits still work):

  1. /ui/api-reference (copy button = the moved CodeBlock), /ui/cost-tracking and /ui/playground (also use CodeBlock)
  2. /ui/memory, /ui/budgets (budget modals), /ui/access-groups (create/edit modals)
  3. /ui/caching (cache settings tab), /ui/projects (project modals), /ui/guardrails-monitor
  4. /ui/admin-panel (SSO/IP/SCIM tabs), /ui/organizations (create/edit org + info view), /ui/router-settings, /ui/old-usage

Local checks: npx vitest run across all moved suites passes with 208 tests over 22 files, npm run build compiles every route, and make pre-commit passes.

Type

🧹 Refactoring

Changes

Colocation follow-up to the App Router migration. It moves each page's owned components out of the shared src/components dump and into its route segment's _components/ folder. This consolidates what were four separate colocation PRs (api-reference, the memory/budgets/access-groups batch, the caching/projects/guardrails-monitor batch, and the admin-panel/organizations/router-settings/old-usage extracts) into one

The convention, applied per component by its import count: a component used by exactly one segment goes in that segment's _components/ (private to the segment, matching Next's _ route-exclusion); a component shared by two or more segments stays in @/components. No new _shared/ folder, so there's no fuzzy second shared home to reason about

Two shapes of change are included. For segments that already had a local components/ folder, it is renamed to _components/ (api-reference, memory, budgets, access-groups, caching, projects, guardrails-monitor); api-reference additionally relocates the shared CodeBlock, which playground and cost-tracking also import, to @/components/CodeBlock. For segments whose page view still lived in the shared dump, the view is extracted into the owning segment (AdminPanel to admin-panel, organizations to organizations, general_settings to router-settings, usage to old-usage)

Every folder or view was verified to have no importer other than its own page, cross-checked across src, tests, and e2e_tests. Relative imports inside moved single files are rewritten from ./x to @/components/x since their genuinely shared dependencies stay in @/components; colocated tests move with their subject and have their vi.mock paths rewritten to keep matching the source's now-absolute imports. Grandfathered lint suppressions (tremor, react-hooks, and similar, all pre-existing) are re-keyed to the new paths with counts unchanged. No behavior changes

Left out deliberately: two larger extracts (UsagePage, 28 files, and settings, 51 files) are mechanical but big enough to warrant their own PRs, and a few views (view_logs, claude_code_plugins, the AIHub/model-hub pair) are genuinely shared across features and need a split rather than a straight move

Colocation follow-up to the App Router migration: move each page's owned
components out of the shared src/components dump and into its route segment's
_components/ folder, draining the shared bucket. Convention: a component used
by exactly one segment goes in that segment's _components/ (private, matching
Next's _ route-exclusion); a component shared by 2+ segments stays in
@/components. No new _shared/ folder.

Rename-in-place (segment already had a local components/ folder):
- api-reference (also relocates the shared CodeBlock, used by playground and
  cost-tracking, to @/components/CodeBlock)
- memory, budgets, access-groups
- caching, projects, guardrails-monitor

Extract from src/components (page view lived in the shared dump):
- AdminPanel -> admin-panel, organizations -> organizations,
  general_settings -> router-settings, usage -> old-usage

Each folder/view was verified to have no importer other than its own page
(cross-checked across src, tests, and e2e_tests). Relative imports inside moved
single files are rewritten to absolute @/components/*; colocated tests move with
their subject and have their vi.mock paths rewritten to match. Grandfathered
lint suppressions (tremor, react-hooks, and similar, all pre-existing) are
re-keyed to the new paths with counts unchanged. No behavior change.
@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR is a structural refactoring that collocates route-private UI components into their owning route segment's _components/ folder and moves the shared CodeBlock into @/components/. No logic, props, or rendering behavior changes — only file locations and import paths change.

  • Import paths in moved files are correctly rewritten from relative (./networking) to absolute (@/components/networking) throughout all 78 changed files, and all vi.mock paths in colocated tests are updated to match.
  • eslint-suppressions.json entries are rekeyed to the new paths with counts unchanged, and the fetchOrganizations named export in the relocated organizations.tsx is still properly exported and mocked in CreateKeyPage.expiredToken.test.tsx.
  • The cost-tracking/components/ folder is not renamed to _components/ in this PR; that and two larger extracts (UsagePage, settings) are explicitly deferred.

Confidence Score: 5/5

Safe to merge — every moved file has only import-path updates; no component logic, props, or rendered output changed.

All 78 files are pure file moves with import rewrites. Old component locations no longer exist and no stale import paths remain in src, tests, or e2e_tests. ESLint suppressions, vi.mock paths, and named exports are all correctly updated. No behavior changes were introduced.

No files require special attention. The one intentional inconsistency — cost-tracking/components/ still using components instead of _components/ — is explicitly deferred per the PR description.

Important Files Changed

Filename Overview
ui/litellm-dashboard/eslint-suppressions.json All 11 moved component paths rekeyed to new _components/ locations with counts unchanged; no suppressions added or removed.
ui/litellm-dashboard/src/app/(dashboard)/admin-panel/_components/AdminPanel.tsx Moved from src/components/AdminPanel.tsx; only change is rewriting 12 relative imports to absolute @/components/ paths.
ui/litellm-dashboard/src/app/(dashboard)/admin-panel/_components/AdminPanel.test.tsx Moved from src/components/AdminPanel.test.tsx; 7 vi.mock paths updated from relative to @/components/ form; all 325 lines preserved.
ui/litellm-dashboard/src/app/(dashboard)/organizations/_components/organizations.tsx Moved from src/components/organizations.tsx; 10 relative imports rewritten to absolute; fetchOrganizations named export preserved and correctly referenced by the test mock.
ui/litellm-dashboard/src/app/(dashboard)/router-settings/_components/general_settings.tsx Moved from src/components/general_settings.tsx; 5 relative imports rewritten to absolute; no logic changes.
ui/litellm-dashboard/src/app/(dashboard)/old-usage/_components/usage.tsx Moved from src/components/usage.tsx; 5 relative imports rewritten to absolute; no logic changes.
ui/litellm-dashboard/src/components/CodeBlock.tsx Promoted from api-reference/components/CodeBlock.tsx to the shared @/components/ root; all three consumers (api-reference, cost-tracking, playground) now import from the new location.
ui/litellm-dashboard/tests/CreateKeyPage.expiredToken.test.tsx Three vi.mock paths updated to reflect new locations of organizations, general_settings, and usage; test logic unchanged.
ui/litellm-dashboard/src/app/(dashboard)/api-reference/_components/APIReferenceView.tsx Moved from api-reference/ root into _components/; CodeBlock import updated to @/components/CodeBlock.
ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/AgentBuilderView.tsx Single import line updated: CodeBlock now imported from @/components/CodeBlock instead of the old api-reference/components/CodeBlock.

Reviews (1): Last reviewed commit: "refactor(ui): colocate 11 route segments..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ryan-crabbe-berri
ryan-crabbe-berri merged commit 65d90fd into litellm_internal_staging Jul 10, 2026
125 checks passed
@ryan-crabbe-berri
ryan-crabbe-berri deleted the litellm_colocate_all branch July 10, 2026 00:43
@codspeed-hq

codspeed-hq Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_colocate_all (f7f367b) with litellm_internal_staging (68a4ca7)

Open in CodSpeed

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.

2 participants