useFrecencySorting ignores how long ago an item was visited when sorting
Nadie ha tomado este issue todavía.
- #85 de @auraseb — cerrado sin fusionar
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- developer-experience
Línea de trabajo
Empieza por el comparador y getNewFrecency en src/useFrecencySorting.ts; compara cómo se actualiza la puntuación almacenada con las visitas y cómo se ordenan los elementos. Comprueba la reproducción mínima comparando un elemento cuya última visita fue hace 60 días con otro que se visitó dos veces hoy. El trabajo estará terminado cuando la ordenación tenga en cuenta el tiempo transcurrido y, en ese caso, el elemento reciente quede primero.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happens
useFrecencySorting stores, for each item, a score and the time of the last visit. When the list is sorted, the stored scores are compared directly:
if (frecencyA && frecencyB) {
return frecencyB.frecency - frecencyA.frecency;
}
The stored score is only decayed when the same item is visited again (in getNewFrecency). At sort time, a score from a year ago and a score from today are treated as if they were taken at the same moment. As a result:
- Two items visited once each always tie at 100, no matter whether the visit was today or a year ago, so the list falls back to the original order.
- An item visited 4 times two months ago (stored score 400) stays above an item visited twice today (stored score 200) forever. With the 10 day half life the old score is worth about 6 today.
Once an item has accumulated a high score it can never be overtaken by recent usage of other items unless it is reset.
What should happen
The docs say "The more often an item is visited, and the more recently an item is visited, the higher it will rank." Recent visits should outrank old ones of the same or similar weight, as in the Firefox algorithm the hook is based on.
Minimal repro
// visit "stale" 4 times, then wait 60 days, then visit "fresh" twice
const { data, visitItem } = useFrecencySorting([{ id: "stale" }, { id: "fresh" }]);
// data is [stale, fresh]; expected [fresh, stale]
Root cause
The comparator in src/useFrecencySorting.ts uses frecency without applying the decay for the time elapsed since lastVisited. Decaying both scores to the same now before comparing fixes it. getNewFrecency already has the decay formula, so it can be shared.
- Lenguaje dominante
- TypeScript
- Estrellas
- 85
- Forks
- 18
- Merge medio
- 8 min
- PR fusionados (30 d)
- 2
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de raycast/utils
-
Feature_Request: OAuthService refreshToken support extra queryQuizá libre de nuevo @thomaslombart la tomó hace 889 días y no hay ningún pull request abierto. Abierto
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Proposal: useObjectStore HookAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Todos los issues de raycast/utils
Issues similares
-
批量图谱关联的备份应排除Obsidian索引Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
logancyang/obsidian-copilot#3753 ·
Los mantenedores suelen responder en 1 día
-
area: presentation severity: important
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
voithos-labs/aragonite#763 ·
Los mantenedores suelen responder en 2 días
-
fix(cursor): align Grok 4.7 context window to 256k/500k and drop unsupported max effort tierAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
diegosouzapw/OmniRoute#17386 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
💡 [Feature] Add an option to hide the empty screen background illustration (Distraction-Free)Abierto
Dificultad 2/5 Medio día Aptitud para principiantes 72/100
super-productivity/super-productivity#10982 · 1 comentario ·
Los mantenedores suelen responder en 1 día