Skip to content

[18] Updated Suspense doc with behavior during SSR and Hydration #4484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 28, 2022
Merged
Changes from 3 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
14 changes: 11 additions & 3 deletions content/docs/reference-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,17 @@ It is documented in our [code splitting guide](/docs/code-splitting.html#reactla

While this is not supported today, in the future we plan to let `Suspense` handle more scenarios such as data fetching. You can read about this in [our roadmap](/blog/2018/11/27/react-16-roadmap.html).

>Note:
>
>`React.lazy()` and `<React.Suspense>` are not yet supported by `ReactDOMServer`. This is a known limitation that will be resolved in the future.
#### `React.Suspense` in SSR
During SSR trees wrapped in Suspense are rendered synchronously as deeply as possible. If the boundary never suspends
then the tree renders as though the boundary were never there. If a component does suspend then we schedule a low
priority task to render the fallback instead. If the component unsuspends before we flush the fallback then we send
down the actual content and throw away the fallback.

#### `React.Suspense` during hydration
Suspense boundaries depend on their parent boundaries being hydrated before they can hydrate, but they can hydrate independently from sibling boundaries. Events on a boundary before its hydrated will cause the boundary to hydrate at
a higher priority than neighboring boundaries. If the code for the boundary is ready then it will hydrate synchronously in the capture phase of the event. Persistent events (`focusin`, `mouseenter`, `dragenter`, `mouseover`, `pointerover`, `gotpointercapture`) will be rebroadcasted using native event dispatch with clones of the original event when their targets hydrate.



### `React.startTransition` {#starttransition}

Expand Down