Skip to content

Favorites now stay visible when filtering models. - #5258

Closed
opencode-agent[bot] wants to merge 2 commits into
devfrom
opencode/issue5254-20251208203721
Closed

opencode-agent[bot] wants to merge 2 commits into
devfrom
opencode/issue5254-20251208203721

Conversation

@opencode-agent

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

Copy link
Copy Markdown
Contributor

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

@DanielFGray

DanielFGray commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

this PR causes an infinite loop after typing in the model modal

@thdxr
thdxr deleted the opencode/issue5254-20251208203721 branch February 7, 2026 06:24
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

3 participants