Global search (Cmd/Ctrl+J) never sorts results by relevance

Aperta Adatta ai principianti
#6,107 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@hamidzr ci sta già lavorando.

Dal 23/11/2026.

  • #6108 di @hamidzr — aperta
  • #6109 di @hamidzr — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nextjs, react, typescript
Ambito
frontend, search

Direzione di ricerca

Inizia in apps/dokploy/package.json, dove cmdk è fissato a ^0.2.1, poi leggi components/ui/command.tsx, che secondo l'issue corrisponde già al wrapper cmdk 1.x. Aggiorna a ^1.1.1, avvia la dashboard e riproduci tramite Cmd/Ctrl+J con un servizio chiamato billing; se il ranking sembra ancora sbagliato, applica la modifica opzionale di value/keywords in components/dashboard/search-command.tsx e rimuovi i wrapper annidati di CommandList intorno alle righe 92 e 121. Fatto significa che una corrispondenza esatta del nome viene ordinata per prima e Enter la apre.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

What happens

Typing a service name in the global search palette filters the list but does not rank it. Results stay in project order, so an exact name match can sit far below weak fuzzy matches. Pressing Enter opens the first item, which is often the wrong service.

Steps to reproduce

  1. Have several projects with a few services each. Create a new service in a later project, e.g. billing.
  2. Press Cmd/Ctrl+J and type billing.
  3. Every service whose text contains the letters of billing in order shows up, in project order. The billing service is not at the top.
  4. Press Enter. It opens the first item in the list, not billing.

Root cause

apps/dokploy/package.json pins cmdk to ^0.2.1. That version's sort is broken:

  • Scores are stored per item id: filtered.items.set(id, score).
  • The sort reads the score by the item's data-value, which is its lowercased text: e.get(item.getAttribute("data-value")).
  • That lookup always returns undefined, so every score counts as 0 and no item moves. Groups are sorted the same way and have the same bug.

cmdk 1.x fixes this by sorting on item.getAttribute("id") (checked in the published [email protected] dist/index.mjs).

The palette's own markup makes the bad order more likely to bite:

  • With no value prop, each service item's value is its full text: project / environment / name plus the service id in a hidden div (components/dashboard/search-command.tsx:159). The random id adds more chance fuzzy matches.
  • Each group wraps its items in an extra <CommandList> (lines 92 and 121) inside the outer one.

Suggested fix

  1. Bump cmdk to ^1.1.1. components/ui/command.tsx already looks like the newer shadcn wrapper written for cmdk 1.x, so the change should be small. Note that 1.x matches value case-sensitively and adds a keywords prop.
  2. Optional: give each service item value={service.name} and keywords={[project.name, environment.name]}, and drop the hidden id div, so the name ranks first and ids stop matching.
  3. Optional: remove the nested <CommandList> wrappers inside the groups.

Related: #5986 (wants Cmd/Ctrl+K for this palette; a separate issue).

Lingua principale
TypeScript
Stelle
38.8k
Fork
3.2k
Merge medio
1g 10h
PR unite (30g)
110

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Dokploy/dokploy

Tutte le issue di Dokploy/dokploy

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.