refactor(search): unify dropdown filtering on the shared ranked matcher
Branch, project, agent, model, provider, stash, SSH-host, skill-catalog and archive filters each had their own toLowerCase().includes (or no ordering at all); the git branch and gitmoji pickers also let cmdk re-filter and reorder on top of the manual filter, silently dropping rows. All of them now go through rankByQuery/matchesRankQuery: results are relevance-ordered, multi-word queries match in any order, matching ignores punctuation, and cmdk filtering is disabled where the ranked list is already final. rankBranchesForQuery keeps relevance order instead of re-sorting matches alphabetically; the model picker now also matches model ids.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { rankByQuery } from '@/lib/search/fuzzySearch';
|
||||
import React from 'react';
|
||||
import QRCode from 'qrcode';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -1255,13 +1256,10 @@ export const RemoteInstancesPage: React.FC = () => {
|
||||
[createImportedInstance],
|
||||
);
|
||||
|
||||
const filteredImportCandidates = React.useMemo(() => {
|
||||
const query = sshHostSearch.trim().toLowerCase();
|
||||
if (!query) return importCandidates;
|
||||
return importCandidates.filter((candidate) => {
|
||||
return candidate.host.toLowerCase().includes(query) || candidate.sshCommand.toLowerCase().includes(query);
|
||||
});
|
||||
}, [importCandidates, sshHostSearch]);
|
||||
const filteredImportCandidates = React.useMemo(
|
||||
() => rankByQuery(importCandidates, sshHostSearch, (candidate) => [candidate.host, candidate.sshCommand]),
|
||||
[importCandidates, sshHostSearch],
|
||||
);
|
||||
|
||||
// Opening a ready instance means pointing this window at the forwarded local
|
||||
// URL — the same navigation the host switcher performs after its own connect.
|
||||
|
||||
Reference in New Issue
Block a user