fix(ui): use antd Select for MCP ToolTestPanel bool inputs#25809
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR replaces the native HTML Confidence Score: 5/5Safe to merge — targeted bug fix with correct antd patterns, no P0/P1 issues. The change correctly addresses the boolean/string type mismatch by using antd Select with native JS boolean option values, following the same pattern already used in guardrail components. The Form.Item initialValue properly drives the controlled Select state. The handleSubmit coercion (value === 'true' || value === true) was already defensive and handles the new boolean path. The test update to getByTitle accurately reflects antd Select's DOM rendering of selected items. All findings are P2 or lower. No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.tsx | Native for boolean fields replaced with antd using boolean option values; Form.Item's initialValue correctly drives the controlled component state. |
| ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.test.tsx | Test assertion updated from getByDisplayValue("True") to getByTitle("True") to match antd Select's DOM rendering of the selected value; change is appropriate and doesn't weaken coverage. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Schema property\n(type: boolean, default: true)"] --> B["buildDefaultValue()\n→ true (JS boolean)"]
B --> C["Form.Item initialValue={true}"]
subgraph OLD ["Old: native select"]
C --> D1["value prop injected as boolean true\nbut option values are strings 'true'/'false'"]
D1 --> E1["onChange emits string 'true' or 'false'"]
E1 --> F1["handleSubmit coercion:\nvalue === 'true' || value === true"]
end
subgraph NEW ["New: antd Select"]
C --> D2["value prop injected as boolean true\nSelect.Option value={true} matches exactly"]
D2 --> E2["onChange emits boolean true or false"]
E2 --> F2["handleSubmit coercion:\nvalue === 'true' || value === true\n(boolean path hit directly)"]
end
F1 --> G["Submitted as boolean"]
F2 --> G
Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/lit..." | Re-trigger Greptile
…itellm_fix_tool_test_panel_bool_rendering
18c93e0
into
litellm_internal_staging
Summary
ToolTestPanel's schema-driven form used a native HTML<select>wrapped in aForm.Item, with string-valued options. Native<select>forces option values to be strings on the DOM, so the form's native-boolean field value never strictly matches, and the control relies on fragile runtime coercion.<Select>+<Select.Option value={true}>/value={false}, matching the fix already shipped inguardrail_optional_params.tsx/guardrail_provider_fields.tsx. antd Select does strict-equality matching on JS values, so native booleans flow through unchanged.getByTitle("True")(antd renders the selected item as a span with a title attribute, not a native select).Test plan
npx vitest run src/components/mcp_tools/ToolTestPanel.test.tsx— 3/3 passbooleaninput, open the Tool Testing Playground, confirm the bool field renders with the backend default pre-selected and submits as a native JSON boolean