reactjs / reactjs/react.dev

[Bug]:Possible wrong descrption for useDeferredValue

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

Ninguém assumiu esta issue ainda.

bug: unconfirmed
Linguagem predominante
JavaScript
Estrelas
11.8k
Forks
7.9k
Merge médio
1d 11h
PRs com merge (30d)
11

Descrição

Summary

The doucmention describe the wrong behaviour for useDeferredValue

Page

https://react.dev/reference/react/Suspense

Details

The documentation says:

The query will update immediately, so the input will display the new value. However, the deferredQuery will keep its previous value until the data has loaded

From my test, deferredQuery also updates immediately rather than waiting for the data to be loaded here is the link https://codesandbox.io/p/sandbox/react-dev-forked-kxfktt

Image

useDeferredValue consistently lags query with around 4 or 5 ms

Think about it, if deferredQuery updates after SearchResults is ready, how SearchResults receive the latest data at the first place?

The real reason we can see opacity: 0.2 for several seconds is that the new content is not rendered yet; rather than

the deferredQuery will keep its previous value until the data has loaded

If my understanding is correct, I should say the documentation is misleading, especially for the newbies

Guia de contribuição

Abrir o guia de contribuição

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.

Direção de pesquisa

Leia a passagem sobre useDeferredValue em https://react.dev/reference/react/Suspense e reproduza o comportamento no CodeSandbox vinculado. Compare a redação sobre deferredQuery com o tempo observado e, em seguida, atualize a documentação para explicar com precisão quando o valor muda e o que a opacidade indica.

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

Avaliação

Stack de tecnologia
react
Domínio
documentation
Tipo de issue
Documentação
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
52/100

Receba novas issues na sua caixa de entrada

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