Skip to content

Conversation

@opencode-agent
Copy link
Contributor

@opencode-agent opencode-agent bot commented Dec 8, 2025

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 setting favoriteOptions and recentOptions to empty arrays whenever a search query existed:

const favoriteOptions = !query ? [...] : []
const recentOptions = !query ? [...] : []

This caused favorites and recent models to completely disappear when typing a search.

The Solution

I refactored the code to:

  1. Build the full option lists unconditionally - Created buildFavoriteOptions and buildRecentOptions to build the complete lists regardless of whether a query exists
  2. Apply fuzzy filtering - When a query exists, use the same fuzzysort fuzzy matching that's used for other models, filtering the favorite and recent options by their title

The key change (lines 108-114):

const favoriteOptions = query
  ? fuzzysort.go(query, buildFavoriteOptions, { keys: ["title"] }).map((x) => x.obj)
  : buildFavoriteOptions

const recentOptions = query
  ? fuzzysort.go(query, buildRecentOptions, { keys: ["title"] }).map((x) => x.obj)
  : buildRecentOptions

Now when you search for a model:

  • ✅ Favorites remain visible and are filtered by the search query
  • ✅ Recent models remain visible and are filtered by the search query
  • ✅ The filtering uses the same fuzzy matching algorithm as the rest of the UI
  • ✅ You can still find and select your favorited models without having to hunt through provider groups

The fix has been validated with TypeScript type checking and compiles successfully.

Closes #5254

New%20session%20-%202025-12-08T20%3A37%3A21.096Z
opencode session  |  github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

user's favorites ignored when filtering

2 participants