Skip to content

fix(ui): route API Reference back to query-param page - #28726

Merged
ryan-crabbe-berri merged 3 commits into
litellm_internal_stagingfrom
litellm_revert_api_reference_path_routing
May 26, 2026
Merged

fix(ui): route API Reference back to query-param page#28726
ryan-crabbe-berri merged 3 commits into
litellm_internal_stagingfrom
litellm_revert_api_reference_path_routing

Conversation

@ryan-crabbe-berri

@ryan-crabbe-berri ryan-crabbe-berri commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

The API Reference page was migrated from query-param routing (?page=api_ref) to a path-based route at /ui/api-reference. In practice the path-based variant resolves proxySettings via a page-local useProxySettings hook that doesn't match what the root app/page.tsx passes everywhere else, so the page rendered with the wrong base URL / API doc base. Move API Reference back to the query-param render branch and leave the migration scaffolding (LEGACY_REDIRECTS, MIGRATED_PAGES) in place — empty — for future page migrations.

What changed

  • leftnav.tsx — menu item back to page: "api_ref"; drop the entry from MIGRATED_PAGES (map kept empty).
  • app/page.tsx — restore the page == "api_ref" ? <APIReferenceView .../> : ... render branch and the APIReferenceView import; drop both api_ref and api-reference entries from LEGACY_REDIRECTS (map kept empty).
  • (dashboard)/layout.tsx — drop the entry from MIGRATED_PAGES (map kept empty).
  • page_metadata.ts — key back to api_ref.

The (dashboard)/api-reference/page.tsx route and the useProxySettings hook are left in place untouched; they're just no longer routed to by the sidebar.

Test plan

  • Click "API Reference" in the leftnav — lands on /ui?page=api_ref and renders the page with the correct base URL.
  • Old bookmarks to /ui/api-reference still load (the route file remains; only sidebar routing changed).
  • Other migration-targeted maps still compile/work with empty entries.

The path-based /ui/api-reference route was broken in practice — the
page-local useProxySettings hook didn't match what the root page passes
down. Remove api_ref from the migration maps (LEGACY_REDIRECTS in
app/page.tsx, MIGRATED_PAGES in leftnav.tsx and (dashboard)/layout.tsx),
point the leftnav item back at page="api_ref", and restore the api_ref
render branch in the root page. The path-based page.tsx and the
useProxySettings hook stay in place unchanged; only api_ref is moved
back to query-param routing while the migration infrastructure is
preserved for future page moves.
@greptile-apps

greptile-apps Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reverts the API Reference page from a path-based route (/ui/api-reference) back to query-param rendering (?page=api_ref) inside app/page.tsx, where proxySettings is correctly sourced from the root-level fetch rather than a page-local useProxySettings hook that returned a mismatched base URL.

  • page.tsx empties LEGACY_REDIRECTS and adds an explicit page == \"api_ref\" || page == \"api-reference\" branch that renders APIReferenceView with the correct proxySettings prop; APIReferenceView itself is a pure prop-driven component with no internal hook calls, so the fix is complete.
  • leftnav.tsx and page_metadata.ts revert the menu item key/page back to api_ref; MIGRATED_PAGES in both layout.tsx and leftnav.tsx are emptied but the scaffolding is intentionally preserved for future migrations.

Confidence Score: 5/5

Safe to merge — the rollback is narrow and targeted, and the component's prop-driven design confirms the fix is complete.

The four changed files all move in the same direction: restoring api_ref query-param rendering. APIReferenceView accepts proxySettings purely as a prop with no internal hook fallback, so passing it from the root fetch is sufficient to resolve the wrong base URL. Both the api_ref and hyphen-form api-reference query params are handled in the new if/else branch, covering transient bookmarks. The empty scaffolding maps compile fine and leave a clean extension point.

No files require special attention.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/app/page.tsx Empties LEGACY_REDIRECTS and adds an explicit if/else branch for both api_ref and api-reference query params, rendering APIReferenceView with proxySettings from the parent — correctly fixes the wrong base URL issue.
ui/litellm-dashboard/src/components/leftnav.tsx Reverts menu item key/page from api-reference back to api_ref and empties MIGRATED_PAGES; comment updated to drop the stale LEGACY_REDIRECTS sync note.
ui/litellm-dashboard/src/app/(dashboard)/layout.tsx Empties MIGRATED_PAGES; scaffolding retained for future page migrations.
ui/litellm-dashboard/src/components/page_metadata.ts Key for API Reference page description reverted from api-reference to api_ref to match the restored query-param routing.

Reviews (2): Last reviewed commit: "fix(ui): alias ?page=api-reference to ap..." | Re-trigger Greptile

Comment thread ui/litellm-dashboard/src/app/page.tsx
Comment on lines 1 to 4
"use client";

import APIReferenceView from "@/app/(dashboard)/api-reference/APIReferenceView";
import SidebarProvider from "@/app/(dashboard)/components/SidebarProvider";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Test plan items remain unchecked

The PR description's test plan has all three items as unchecked ([ ]), meaning there is no evidence that the fix was verified — including the primary user flow ("Click API Reference → lands on /ui?page=api_ref"). Per the team's review standards, a PR claiming to fix an issue should include evidence that the issue is resolved before merging.

Rule Used: What: Ensure that any PR claiming to fix an issue ... (source)

@codecov

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Handles bookmarks of the hyphen-form query param that was live during
the brief path-based migration window, so they render the working
APIReferenceView instead of falling through to the default page.
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai re review

@ryan-crabbe-berri
ryan-crabbe-berri merged commit a8263cb into litellm_internal_staging May 26, 2026
114 of 116 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
* fix(ui): route API Reference back to query-param page

The path-based /ui/api-reference route was broken in practice — the
page-local useProxySettings hook didn't match what the root page passes
down. Remove api_ref from the migration maps (LEGACY_REDIRECTS in
app/page.tsx, MIGRATED_PAGES in leftnav.tsx and (dashboard)/layout.tsx),
point the leftnav item back at page="api_ref", and restore the api_ref
render branch in the root page. The path-based page.tsx and the
useProxySettings hook stay in place unchanged; only api_ref is moved
back to query-param routing while the migration infrastructure is
preserved for future page moves.

* fix(ui): alias ?page=api-reference to api_ref branch

Handles bookmarks of the hyphen-form query param that was live during
the brief path-based migration window, so they render the working
APIReferenceView instead of falling through to the default page.
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