Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Cached AJAX responses lose status metadata exposed through vm.route.response

Aberta
#2,812 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 8 dias

@xu91102 já está trabalhando nisso.

Desde 26/9/2026.

  • #2813 de @xu91102 — aberto

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
68/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
javascript
Domínio
web-dev

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
JavaScript
Estrelas
31.5k
Forks
5.8k
Merge médio
7d 18h
PRs com merge (30d)
9

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de docsifyjs/docsify

Todas as issues de docsifyjs/docsify

Issues semelhantes

Mais issues de JavaScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.