You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/reference/react/Suspense.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2740,7 +2740,7 @@ Where you place the `<ViewTransition>` relative to the boundary determines wheth
2740
2740
2741
2741
### <CanaryBadge /> Waiting for a font to load {/*waiting-for-a-font-to-load*/}
2742
2742
2743
-
When a [`<ViewTransition>`](/reference/react/ViewTransition) animates a Suspense boundary's reveal, React also waits for new fonts the content introduces, up to a timeout, so the text doesn't flash with a fallback font. This only happens during a `<ViewTransition>` update.
2743
+
When a [`<ViewTransition>`](/reference/react/ViewTransition) animates a Suspense boundary's reveal, React waits for new fonts the content introduces, up to a timeout, so the text doesn't flash with a fallback font. This only happens during a `<ViewTransition>` update.
2744
2744
2745
2745
In the example below, the Suspense boundary is wrapped in a `<ViewTransition>`, and the `Quote` component suspends while its data loads. Rendering the quote starts its font download. React keeps the fallback visible until the font has loaded, so the quote appears already in its font.
2746
2746
@@ -2890,7 +2890,7 @@ hr {
2890
2890
2891
2891
### <CanaryBadge /> Waiting for an image to load {/*waiting-for-an-image-to-load*/}
2892
2892
2893
-
Images work the same way: when a [`<ViewTransition>`](/reference/react/ViewTransition) animates a Suspense boundary's reveal, React waits for visible images to load, up to a timeout, so the animation doesn't start with a half-loaded image. This only happens during a `<ViewTransition>` update. Adding an `onLoad` handler opts a specific image out, even inside a `<ViewTransition>`.
2893
+
When a [`<ViewTransition>`](/reference/react/ViewTransition) animates a Suspense boundary's reveal, React waits for visible images to load, up to a timeout, so the animation doesn't start with a half-loaded image. This only happens during a `<ViewTransition>` update. Adding an `onLoad` handler opts a specific image out, even inside a `<ViewTransition>`.
2894
2894
2895
2895
In the example below, the Suspense boundary is wrapped in a `<ViewTransition>` and shows a profile skeleton until the portrait has loaded.
2896
2896
@@ -3023,9 +3023,9 @@ hr {
3023
3023
3024
3024
### <CanaryBadge /> Coordinating fonts, images, and stylesheets {/*coordinating-fonts-images-and-stylesheets*/}
3025
3025
3026
-
All of these waits work together. In the example below, the `ProfileCard` component suspends while its data loads, and renders a stylesheet with `precedence`, text in a new font, and a portrait. React keeps the skeleton visible while the data and the stylesheet load. The `<ViewTransition>` reveal then waits for the font and the image, so the card appears complete.
3026
+
A single Suspense boundary can wait for several of these resources at once. In the example below, the `ProfileCard` component suspends while its data loads, and renders a stylesheet with `precedence`, text in a new font, and a portrait. React keeps the skeleton visible while the data and the stylesheet load. The `<ViewTransition>` reveal then waits for the font and the image, so the card appears complete.
3027
3027
3028
-
For comparison, the second button performs the same update with plain DOM, without React. It loads the same data first, and then each resource pops in as it arrives:
3028
+
For comparison, the plain DOM version loads the same data and shows every resource arriving on its own schedule:
3029
3029
3030
3030
<Sandpack>
3031
3031
@@ -3155,7 +3155,7 @@ export function freshImageUrl() {
3155
3155
exportasyncfunctionfetchQuote() {
3156
3156
// Add a fake delay to make waiting noticeable.
3157
3157
awaitnewPromise((resolve) => {
3158
-
setTimeout(resolve, 300);
3158
+
setTimeout(resolve, 2000);
3159
3159
});
3160
3160
return'The best way to predict the future is to invent it.';
0 commit comments