Repository navigation
feat(dashboard): Done button in model picker for combo creation - #4496
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Code Review
This pull request introduces a keepOpenOnSelect prop to ModelSelectModal, allowing callers like the combo creation form to keep the modal open for sequential selections, accompanied by a "Done" button in the footer. Unit tests have been added to cover this new functionality. The review feedback recommends minor cleanups in the test file, specifically replacing an unnecessary dynamic import with a standard static import and removing a redundant empty act block.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| useTranslations: () => (key: string) => key, | ||
| })); | ||
|
|
||
| const { default: ModelSelectModal } = await import("@/shared/components/ModelSelectModal"); |
There was a problem hiding this comment.
Using a dynamic import with top-level await is unnecessary here. Standard static imports are more idiomatic in Vitest/TypeScript test files and are fully compatible with Vitest's hoisted mocking system.
| const { default: ModelSelectModal } = await import("@/shared/components/ModelSelectModal"); | |
| import ModelSelectModal from "@/shared/components/ModelSelectModal"; |
| ); | ||
| }); | ||
|
|
||
| await act(async () => {}); |
65b6ca7 to
fa37b2b
Compare
Adds an opt-in `keepOpenOnSelect` prop to `ModelSelectModal`. When the combos page sets it, picking a model no longer auto-closes the modal and a full-width "Done" button is rendered in the footer (via Modal's `footer` slot) so users can add several models in a row and confirm explicitly. All other single-select callers keep the existing auto-close-on-select behaviour (the prop is off by default). When `multiSelect` is on, the existing Clear+Done footer wins to avoid two competing footers. The upstream JS variant gates the Done button on `!closeOnSelect`. TDD coverage: tests/unit/ui/model-select-modal-keep-open.test.tsx asserts the Done button is absent by default, present when `keepOpenOnSelect=true`, fires only `onClose` (not a stray `onSelect`), and that `multiSelect` still renders exactly one Done button. Inspired-by: decolua/9router#1031 Co-authored-by: Zanuar Tri Romadon <triromadon@gmail.com>
fa37b2b to
c49757b
Compare
…per-inference#4496) Rebuilt onto release/v3.8.33 (squash-base-stale). Integrated into release/v3.8.33.
cheaper-inference#4498) Rebuilt onto release/v3.8.33; reconciled with the already-merged keepOpenOnSelect (cheaper-inference#4496) — deselection now rides the existing keepOpenOnSelect + onDeselect wiring instead of a redundant closeOnSelect prop. Integrated into release/v3.8.33.
Summary
Adds an opt-in
keepOpenOnSelectprop toModelSelectModal. When thecombos page sets it, picking a model no longer auto-closes the modal and
a full-width Done button is rendered in the footer (via Modal's
footerslot) so users can add several models in a row and confirmexplicitly. Inspired by upstream PR the upstream fix.
Why
Combo creation typically adds 2-5 models. Today the modal auto-closes
on every pick, forcing the user to reopen the picker for each model —
the same UX complaint the upstream PR fixes for the JS variant.
OmniRoute already shows an "added" check-mark on previously selected
models (via
addedModelValues), so the only missing piece was theability to keep the modal open and confirm the batch.
What changed
src/shared/components/ModelSelectModal.tsx— newkeepOpenOnSelect?: booleanprop (default
false, so all 10+ existing single-select callers stayon auto-close). When set and
!multiSelect, the modal renders afull-width Done button in its footer. The
multiSelectClear+Donefooter wins when both are set, to avoid two competing footers.
src/app/(dashboard)/dashboard/combos/page.tsx— passeskeepOpenOnSelectto the picker. Single-line change.
tests/unit/ui/model-select-modal-keep-open.test.tsx— new Vitestunit test (4 cases) covering: default has no Done button, prop adds
it, Done click triggers
onClose(not a strayonSelect),multiSelectstill renders exactly one Done button.CHANGELOG.md— entry under[3.8.32] → ✨ New Features.Notes on the port
closeOnSelect={false}. OmniRoute'sTypeScript modal already had a similar
multiSelectmode whose footerincludes a Clear button (calls
onSelect(null)), but Clear isincompatible with the combo handler shape (combo entries are
{model, providerId, weight}, not bare values). So instead ofreusing
multiSelect, the port adds a small sibling prop(
keepOpenOnSelect) that only suppresses auto-close and renders theDone button — no Clear, no
selectedModelssemantics.t("done")translation key already exists in all locales(
common.donewas added whenmultiSelectshipped). No new i18nkeys.
Test plan
npx vitest run tests/unit/ui/model-select-modal-keep-open.test.tsx— 4/4 passnpx vitest run tests/unit/ui/model-select-modal-zero-config.test.tsx— 3/3 pass (no regression)npm run typecheck:core— cleannpx eslinton touched files — cleanadding several models, then clicking Done closes the modal. Other
callers (CLI tool cards) keep auto-close.