reactjs / reactjs/react.dev

[Bug]:Possible wrong descrption for useDeferredValue

オープン
#8,324 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug: unconfirmed
主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
1日 11時間
マージ済み PR(30日)
11

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

https://react.dev/reference/react/Suspense の useDeferredValue に関する説明を読み、リンク先の CodeSandbox でその動作を再現してください。deferredQuery についての記述と観測されたタイミングを比較し、その値がいつ変化するのか、また不透明度が何を示しているのかを正確に説明するようドキュメントを更新してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。