fix(ui): remove blank leading entry from access group model dropdown - #27521
Conversation
The Allowed Models dropdown on the Access Groups create modal showed a
blank first row above the actual model list. The Special Options branch
of `ModelSelect`'s options array used a ternary that returned `[]` when
`includeSpecialOptions` was falsy, but the result was placed as a single
element of the outer array (not spread) — so antd's Select rendered the
empty array as a blank optgroup at the top. Switch to the same
`...(cond ? [{...}] : [])` spread pattern already used by the Wildcard
Options and Models branches.
No behavior change for callers that pass `includeSpecialOptions={true}`.
Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR fixes a blank leading row in antd's
Confidence Score: 5/5Safe to merge — the change is a one-line structural fix confined to a single component with no impact on callers that already pass The fix is surgical: one spread operator change that eliminates the stray empty array element, leaving the rendered output identical for all existing callers. The regression test correctly targets the bug scenario and fails before the fix, passes after. No other files are touched and no new dependencies are introduced. No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.tsx | Fixes the blank leading dropdown entry by spreading the Special Options branch — from includeSpecialOptions ? {…} : [] to ...(includeSpecialOptions ? [{…}] : []) — matching the existing wildcard/models pattern. |
| ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.test.tsx | Adds a focused regression test that renders ModelSelect with context="global" (no includeSpecialOptions) and asserts exactly two optgroups appear with non-empty labels; test relies on document.querySelectorAll which queries the global DOM rather than the component's container. |
Reviews (1): Last reviewed commit: "fix(ui): remove blank leading entry from..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
b799f94
into
BerriAI:shin_agent_oss_staging_05_09_2026
|
🤖 litellm-agent: Squash-merged into staging branch Triage Summary Merge Confidence: 5/5 ✅ READY All checks green. Greptile 5/5, no blocking pattern findings, no CircleCI runs (OSS-typical). |
…erriAI#27521) Squash-merged by litellm-agent from Bytechoreographer's PR.

PR: fix(ui): blank leading entry in Models dropdown when creating an access group
Relevant issues
Pre-Submission checklist
npx vitest run src/components/ModelSelect/ModelSelect.test.tsxpasses (13/13, including a new regression test)includeSpecialOptions@greptileaiand get Confidence Score ≥ 4/5 before requesting maintainer reviewType
🐛 Bug Fix
Changes
Root cause
On the Access Groups → Create modal, opening the Allowed Models dropdown
shows a blank/empty entry as the first item, above the actual model list.
AccessGroupBaseForm.tsx:81renders the model picker as<ModelSelect context="global" ... />— withoutincludeSpecialOptions. InsideModelSelect.tsx, theoptionsarray passed to antd'sSelectis built likethis:
The first element uses a ternary that returns
[]whenincludeSpecialOptionsis falsy — but it is placed as a single element of theouter array, not spread. So antd receives:
antd
Selectwalks each top-level element as an option group. The bare[]has no
label/value, so it renders as an empty/blank leading row in thepopup. The two siblings below (
Wildcard Options,Models) already use thecorrect
...(cond ? [{...}] : [])spread pattern; only the Special Optionsbranch was inconsistent.
Reproduce:
Fix
Change the first branch to match the spread pattern already used by the other
two branches:
options={[ - includeSpecialOptions - ? { label: ..., title: "Special Options", options: [ ... ] } - : [], + ...(includeSpecialOptions + ? [ + { label: ..., title: "Special Options", options: [ ... ] }, + ] + : []), ...(wildcard.length > 0 ? [{ ... }] : []), { label: <span>Models</span>, title: "Models", options: regular.map(...) }, ]}Now the array contains only real groups. Empty branches contribute zero
elements instead of an empty array, so the leading blank row disappears.
No behavior change for callers that pass
includeSpecialOptions={true}(team / organization / user model pickers): before the fix the array was
[ {special}, {wildcard?}, {models} ], after the fix it is still[ {special}, {wildcard?}, {models} ]. The bug only ever manifested whenincludeSpecialOptionswas falsy — which today is just the access-groupcreate/edit form (
context="global"without the flag).Tests
Added a regression test in
ModelSelect.test.tsxthat renders<ModelSelect context="global" />(the same wayAccessGroupBaseFormcallsit) and asserts the rendered popup contains exactly two
<optgroup>s(
Wildcard Options+Models), each with a non-emptylabel. Before the fixthis test produces three optgroups, the first with
label=undefined—matching the visual blank-row symptom.
Files changed
ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.tsxSpecial Optionsbranch to the same...(cond ? [{...}] : [])spread pattern used byWildcard Options/Models, so a falsyincludeSpecialOptionscontributes zero elements instead of an empty arrayui/litellm-dashboard/src/components/ModelSelect/ModelSelect.test.tsxincludeSpecialOptionsis omitted