Favorites now stay visible when filtering models. #5258
+2,449
−584
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Summary
I've successfully fixed the issue where favorites and recent models were being hidden when filtering! Here's what was changed:
The Problem
In
dialog-model.tsx(lines 45 and 78), the code was settingfavoriteOptionsandrecentOptionsto empty arrays whenever a search query existed:This caused favorites and recent models to completely disappear when typing a search.
The Solution
I refactored the code to:
buildFavoriteOptionsandbuildRecentOptionsto build the complete lists regardless of whether a query existsfuzzysortfuzzy matching that's used for other models, filtering the favorite and recent options by their titleThe key change (lines 108-114):
Now when you search for a model:
The fix has been validated with TypeScript type checking and compiles successfully.
Closes #5254
opencode session | github run