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

Abierto Apto para principiantes
#6,107 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@hamidzr ya está trabajando en esto.

Desde el 23/11/2026.

  • #6108 de @hamidzr — abierto
  • #6109 de @hamidzr — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
74/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
nextjs, react, typescript
Área
frontend, search

Línea de trabajo

Empieza en apps/dokploy/package.json, donde cmdk está fijado a ^0.2.1, luego lee components/ui/command.tsx, que según el issue ya coincide con el wrapper de cmdk 1.x. Sube a ^1.1.1, ejecuta el dashboard y reproduce con Cmd/Ctrl+J con un servicio llamado billing; si el ranking sigue viéndose mal, aplica el cambio opcional de value/keywords en components/dashboard/search-command.tsx y elimina los wrappers anidados de CommandList alrededor de las líneas 92 y 121. Hecho significa que una coincidencia exacta de nombre se ordena primero y Enter la abre.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).

Lenguaje dominante
TypeScript
Estrellas
38.8k
Forks
3.2k
Merge medio
1 d 10 h
PR fusionados (30 d)
110

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Dokploy/dokploy

Todos los issues de Dokploy/dokploy

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.