Skip to content

Commit 723efff

Browse files
committed
Clarify deferred renders that suspend
1 parent 46a54e0 commit 723efff

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/content/reference/react/Suspense.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ export default function App() {
11671167
}
11681168
```
11691169

1170-
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, so `SearchResults` will show the stale results for a bit.
1170+
The `query` updates immediately, so the input displays the new value. React first renders with the previous `deferredQuery`, then tries a background render with the new value. If that render suspends while the data loads, React keeps showing the previous results until the new results are ready.
11711171

11721172
To make it more obvious to the user, you can add a visual indication when the stale result list is displayed:
11731173

‎src/content/reference/react/useDeferredValue.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export default function App() {
260260
}
261261
```
262262

263-
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, so `SearchResults` will show the stale results for a bit.
263+
The `query` updates immediately, so the input displays the new value. React first renders with the previous `deferredQuery`, then tries a background render with the new value. If that render suspends while the data loads, React keeps showing the previous results until the new results are ready.
264264

265265
Enter `"a"` in the example below, wait for the results to load, and then edit the input to `"ab"`. Notice how instead of the Suspense fallback, you now see the stale result list until the new results have loaded:
266266

0 commit comments

Comments
 (0)