Repository navigation
Conversation
…lector Filter recent and favorites with model.visible in createModelSelectorController so hidden models do not leak into the picker.
There was a problem hiding this comment.
The fix looks correct. The Recent and Favorites lists now use the same model.visible(...) filter the provider groups already use, so models hidden in Settings → Models no longer show up there. I couldn't run the issue's browser reproduction (no Chromium here). Instead I ran your new tests against the base with only the export added: both fail there and pass with this change. tsc -b in packages/app passes. I checked whether cycle() in selection.tsx could still land on hidden recent models; it doesn't matter here, because nothing in the app calls the model cycle.
Public API: unchanged. Exporting createModelSelectorController affects only the app package.
The tests are large for a two-line filter; see the inline comment.
| }) | ||
|
|
||
| test("createModelSelectorController filters recent and favorites by provider and visibility together", () => { | ||
| createRoot((dispose) => { |
There was a problem hiding this comment.
Both tests repeat the same ~30-line fake ModelSelection to check two filters. Could you cut this down to one small test, for example one fake shared through a helper, with one hidden recent entry, one hidden favorite and the provider scope? Then the file shows the fixed behaviour without the repeated setup.
Simplify test setup into a single focused test checking visibility filtering in both unscoped and provider-scoped controllers.
|
Updated in 5f7117c. Consolidated into a single concise test that covers hidden recent and favorite models, both unscoped and with provider filtering, removing the repeated setup. |
There was a problem hiding this comment.
The tests are now one small test covering hidden recent and favorite entries plus the provider scope, which addresses my earlier comment. The test fails on the base and passes with this change, and tsc -b in packages/app passes. I still couldn't run the issue's browser reproduction here (no Chromium). The fix itself is unchanged and looks correct.
Public API: unchanged.
Issue for this PR
Closes #60911
Type of change
What does this PR do?
In
createModelSelectorController(packages/app/src/providers/models/select-dialog.tsx), provider groups were filtered bymodel.visible(...), butfavoritesandrecentlists were returned directly without checking model visibility. Consequently, models turned off in Settings → Models still leaked into the Recent and Favorites sections of the model picker dialog.This change filters both
favoritesandrecentwithmodel.visible({ modelID: item.id, providerID: item.provider.id })increateModelSelectorControllerso that hidden models are excluded from all sections of the picker dialog and drawer.How did you verify your code works?
packages/app/test-browser/select-dialog.test.tschecking thatcreateModelSelectorController:recent()andfavorites().bun run test:browser(305 passed across 55 files).bun run test:unit(948 passed across 128 files).bun run typecheck.bun run lint:changed(0 problems).Checklist