Repository navigation
fix(ui): keep Virtual Keys list state in the URL so it survives leaving the page - #39481
Merged
yuneng-berri merged 5 commits intoSep 3, 2026
Merged
Conversation
…ng the page The search term, sort, pagination and drawer filters lived in component state, so navigating away from Virtual Keys and back reset the table to an unfiltered first page. Move them into query state alongside the existing ?key= deep link, which also makes a filtered view shareable.
The unprefixed team_id filter hijacked the /api-keys create-key deep link, which already takes team_id as a prefill, so ?create=true&team_id=X silently filtered the list underneath the modal. Prefix the four drawer filters. Now that page and page_size come from the address bar, clamp them to what /key/list accepts instead of forwarding 0, negatives or an int64-overflowing page straight through, and trim filter values arriving from a URL the same way the drawer already trims them.
… one A hand-edited or stale sort_by reached /key/list, which 400s it, leaving the Virtual Keys page on its loading skeleton with no error. Validate it against the fields the table's own headers can produce, and clear sort_by rather than blanking it when a sort is reset so the URL stays clean. Also replaces a default-state URL assertion that ran before any query-state write could land, so it could not fail for the regression it named.
yuneng-berri
enabled auto-merge (squash)
September 3, 2026 03:12
Contributor
Greptile SummaryThe PR moves the organization-wide Virtual Keys table’s search, sorting, pagination, and filters into validated URL query parameters so views survive navigation and can be shared.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx | Replaces local table state with validated URL-backed state and correctly resolves TanStack controlled-state callbacks with functionalUpdate. |
| ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx | Adds comprehensive coverage for URL restoration, updates, defaults, bounds, filter clearing, and sortable-field validation without revealing a blocking regression. |
| ui/litellm-dashboard/src/components/VirtualKeysPage/keyTableColumns.tsx | Exports the existing sortable-field allowlist so URL input can be validated against fields supported by the table and API. |
Reviews (2): Last reviewed commit: "fix(ui): use TanStack's functionalUpdate..." | Re-trigger Greptile
…ater resolver The local helper narrowed typeof updater === "function" against an unconstrained T, which TypeScript cannot do because T itself may be a function type, so next build failed to type check. table-core already exports the same helper.
Contributor
Author
|
Last commit swapped the hand-rolled updater resolver for TanStack's own @greptileai review Generated by Claude Code |
Contributor
ryan-crabbe-berri
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
How it solves it:
?key=deep link already thereUser Flow
Before: an admin filtering a long key list loses the filter every time they step away from the page
.../api-keys/After: the same admin returns to the list exactly as they left it
.../api-keys/?key_search=followed by what they typedRelevant issues
Linear ticket
Resolves LIT-3370
Pre-Submission checklist
Screenshots / Proof of Fix
Driven against a live proxy with the Admin UI dev server, signed in as a proxy admin, with 33 virtual keys present. Steps are the same on both sides.
Before (bcd3e2d)
Case 1: a filtered list survives leaving the page and coming back
seed-key-1Case 2: a filtered view opens from a pasted link
/api-keys/?key_search=seed-key-1directly, as if pasted from a teammateAfter (a223b76)
Case 1: a filtered list survives leaving the page and coming back
seed-key-1Case 2: a filtered view opens from a pasted link
/api-keys/?key_search=seed-key-1directly, as if pasted from a teammateHand-edited URLs, same browser session, at a223b76
These params are typed by hand now, so they are clamped and validated before they reach
/key/list:Filter round trip and the key detail round trip:
Search box input paths (click, type per character, blur, escape-then-type, paste): the value is never wiped, and one request fires per settled value.
Reviewer UI check, if you want to see it yourself: open http://localhost:4000/ui/?page=api-keys, type something into the key search box, click Teams in the sidebar, then press the browser Back button.
Type
🐛 Bug Fix
Caveats (if any)
Low