[Bug]:Possible wrong descrption for useDeferredValue
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 7.9k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
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
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the useDeferredValue passage on https://react.dev/reference/react/Suspense and reproduce the behavior in the linked CodeSandbox. Compare the wording about deferredQuery with the observed timing, then update the documentation so it accurately explains when the value changes and what the opacity indicates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100