refactor(ui): convert caching page charts to shadcn/recharts - #32721
Conversation
Greptile SummaryConverts the two tremor
Confidence Score: 5/5Straightforward UI-layer swap with no changes to data-fetching logic, API contracts, or non-chart state; the interface-to-type conversion is correct and narrowly scoped. Both changed files are self-contained to the caching page analytics tab. The production change replaces tremor components with shadcn equivalents without touching any data-fetching, filtering, or business logic. The type alias change is TypeScript-only with no runtime effect. No regressions are introduced. No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/app/(dashboard)/caching/_components/cache_dashboard.tsx | Converts two tremor BarCharts to the shared shadcn/recharts BarChart wrapper inside shadcn Cards; changes interface uiData to a type alias for Record<string, unknown> compatibility; no logic changes |
| ui/litellm-dashboard/src/app/(dashboard)/caching/_components/cache_dashboard.test.tsx | New colocated test suite covering card titles, legend-to-fill mapping, bar stack order, x-axis call_type labels, stacked column count, and compact y-axis tick formatting; some recharts SVG-internals coupling already flagged in prior thread |
Reviews (2): Last reviewed commit: "test(ui): bind cache chart legend labels..." | Re-trigger Greptile
|
@greptileai re review |
fdfb122
into
litellm_internal_staging
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
QA on the caching page (screenshots to follow in a comment):
python litellm/proxy/proxy_cli.py --config litellm/proxy/dev_config.yaml) and the dashboard dev server (npm run devin ui/litellm-dashboard)for i in 1 2 1 2; do curl -s http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-..." -H "Content-Type: application/json" -d "{\"model\": \"gpt-5.2\", \"messages\": [{\"role\": \"user\", \"content\": \"hi $i\"}]}"; donetitleprop that tremor silently ignoredBefore (staging, tremor BarChart) and after (this branch, recharts through the shared wrapper) should look near-identical; sky and teal resolve to the same tailwind-500 palette tremor rendered
Type
🧹 Refactoring
Changes
Stage PR for the charts track of the shadcn migration (foundation: #32668). Converts the two tremor BarCharts on the caching page's Cache Analytics tab to the shared
BarChartwrapper; no wrapper changes were needed since every prop these sites pass (data/index/categories/colors/valueFormatter/stack/yAxisWidth/className) is already coveredEach chart moves into its own shadcn Card following the pilot (ScoreChart): the tremor Subtitle headings become CardTitles, which also absorbs the first chart's
titleprop; that prop is not part of tremor's BarChart API and rendered nothing, so the text is now actually visible as the card title. The second chart'smt-6spacing is preserved on its Card. Everything else on the page (the outer tremor Card, the filter row, the stat mini cards, the tabs) stays tremor and converts in a later page-level phaseThe
uiDatainterface becomes a type alias so the row type satisfies the wrapper'sRecord<string, unknown>constraint (interfaces have no implicit index signature)New colocated test renders the dashboard with a mocked activity fetch and asserts against the real recharts SVG: both card titles, a legend-bound mapping from each category label to its sky/teal fill (read off the legend swatches, so swapping either the categories or the colors fails the test) plus the bar stack order, one stacked column per call type, the
nameindex on the x axis, and compact (60Kstyle) y-axis tick formatting viavalueFormatterNumbers