Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/content/reference/react/Suspense.md
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ export default function App() {
}
```

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.
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.

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

Expand Down
2 changes: 1 addition & 1 deletion src/content/reference/react/useDeferredValue.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export default function App() {
}
```

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.
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.

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:

Expand Down
Loading