Cached AJAX responses lose status metadata exposed through vm.route.response
Los mantenedores suelen responder en 8 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript
- Área
- web-dev
Línea de trabajo
Start at Fetch's contentFetched handler and trace the cache-hit path that invokes the success callback. Reproduce the case with the existing xhr-mock dependency in the Jest/JSDOM setup, then verify that a cached request passes the original content, options, and response metadata consistently with the first request.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug Report
Current behavior
The first AJAX request calls the success callback with (content, options, responseStatus), but a cache hit calls it with only (content, options). Fetch's contentFetched handler assigns that third argument to vm.route.response, so revisiting a cached page loses the response status available on the first visit.
On develop f34374b7423340e5ddec81c8ff565c26cc056fb5, a regression using the existing xhr-mock dependency shows:
get('/page.md').then((content, options, response) => {
// First request: response is { ok: true, status: 200, statusText: 'OK' }
get('/page.md').then((cachedContent, cachedOptions, cachedResponse) => {
// cachedResponse is undefined
});
});
Expected behavior
Cached content should carry the original response metadata too. Plugins should be able to inspect vm.route.response consistently across initial loads and revisits without adding cache-specific workarounds.
Suggested fix
Store the response status alongside the cached content and options, and pass all three to the callback on cache hits. This preserves the actual response status rather than synthesizing a 200 response.
Environment
Docsify 5.0.0 develop source, Jest/JSDOM on macOS. Reproduced with an HTTP response mock at the XMLHttpRequest boundary.
- Lenguaje dominante
- JavaScript
- Estrellas
- 31.5k
- Forks
- 5.8k
- Merge medio
- 7 d 18 h
- PR fusionados (30 d)
- 9
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
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 docsifyjs/docsify
-
Query parameter values are truncated at a second equals signPosiblemente ocupada @xu91102 la tomó hace 24 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 8 días
-
Bullet points beginning with inline math: subsequent text formatting not recognised correctlyAbiertobug Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
docsifyjs/docsify#2839 · 1 comentario ·
Los mantenedores suelen responder en 8 días
-
In the Edge browser, the character `{docsify-updated}` is not replacedQuizá libre de nuevo @AmanUllah687 la tomó hace 77 días y no hay ningún pull request abierto. Abiertowait for information
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
docsifyjs/docsify#2681 · 11 comentarios ·
Los mantenedores suelen responder en 8 días
-
Nested/Recursive includesAbiertofeature request Triage
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
docsifyjs/docsify#2643 · 5 comentarios ·
Los mantenedores suelen responder en 8 días
-
Is it possible not to push unnecessary state when clicking an <a> element?Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoneeds discussion
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 8 días
Todos los issues de docsifyjs/docsify
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
andromarces/agent-loops#976 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
openstreetmap/iD#13019 ·
Los mantenedores suelen responder en 2 días
-
[Blockly] historic state medianAbiertobug main ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
openhab/openhab-webui#4600 ·
Los mantenedores suelen responder en 4 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día