Define global allowQuery / varies in nitro config

Abierto
#5,000 1 comentario 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
40/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

The feature touches the cache configuration in nitro.config.ts and the cachedHandler options, so start with how cache.defaults is read and merged with per-handler allowQuery and varies. The docs at https://nitro.build/docs/cache#global-options are the reference for current behaviour. Done means a global default can be set and a handler's cache key includes it, with the merge rule documented.

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

Descripción

cache config
Describe the feature

It would be nice if query params can be set in nitro.config.ts, so these query params always vary the cache key and reach every handler.

E.g. if every route takes a locale query param ?locale=fr, locale could be added globally so one does not have to add it to every cachedHandler (and possibly forgets it).

The same example when using Accept-Language header instead of query param: accept-language could be added to global varies, so one does not have to add it to every cachedHandler (and possibly forgets it).

Additional information

Apparently nitro config already allows for cache.defaults to be set but the docs don't say whether cachedHandlers allowQuery replaces or merges with the default: https://nitro.build/docs/cache#global-options

Lenguaje dominante
TypeScript
Estrellas
11.5k
Forks
968
Merge medio
4 d 9 h
PR fusionados (30 d)
64

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 nitrojs/nitro

Todos los issues de nitrojs/nitro

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.