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: docs/source/performance/server-side-rendering.mdx
+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
@@ -129,9 +129,9 @@ It's important to create an _entirely new instance_ of Apollo Client for each re
129
129
130
130
### Executing queries with `prerenderStatic`
131
131
132
-
You can instruct Apollo Client to execute all of the queries executed by the `useQuery` or `useSuspenseQuery`hooks in the React tree's components with the `prerenderStatic` function.
132
+
You can instruct Apollo Client to execute all of the queries executed by the `useQuery` or the suspenseful query hooks (like `useSuspenseQuery`and `useBackgroundQuery`) in the React tree's components with the `prerenderStatic` function.
133
133
134
-
This function rerenders your React tree until no more network requests are made. When you use suspenseful hooks (like `useSuspenseQuery`) with a suspense-ready rendering function, the tree is rendered once and suspends while network requests are executed. When you use non-suspenseful hooks (like `useQuery`), this function renders all components, waits for all requests to finish, and then re-renders the tree until no more requests are made.
134
+
This function rerenders your React tree until no more network requests are made. When you use suspenseful hooks with a suspense-ready rendering function, the tree is rendered once and suspends while network requests are executed. When you use non-suspenseful hooks (like `useQuery`), this function renders all components, waits for all requests to finish, and then re-renders the tree until no more requests are made.
135
135
136
136
The function returns a `Promise` that resolves when all result data is ready in the Apollo Client cache and the final render is complete.
137
137
@@ -141,7 +141,7 @@ The function returns a `Promise` that resolves when all result data is ready in
141
141
142
142
-**`prerender`** from `react-dom/static` - Recommended for Deno or modern edge runtimes with Web Streams. Supports React Suspense.
143
143
-**`prerenderToNodeStream`** from `react-dom/static` - Recommended for Node.js. Supports React Suspense.
144
-
-**`renderToString`** from `react-dom/server` - Legacy API without Suspense support. Won't work with `useSuspenseQuery`.
144
+
-**`renderToString`** from `react-dom/server` - Legacy API without Suspense support. Won't work with suspenseful hooks.
145
145
-**`renderToStaticMarkup`** from `react-dom/server` - Legacy API without Suspense support. Slightly faster than `renderToString`, but the result cannot be hydrated.
146
146
147
147
The following code replaces the `TODO` comment within the `app.use` call in the example above:
@@ -222,7 +222,7 @@ In the end, it's a tradeoff between more work on the server and a potential dela
222
222
</Note>
223
223
224
224
<Tip>
225
-
If you are only using suspenseful hooks like `useSuspenseQuery` and no `useQuery` hooks, is also possible to use the [@apollo/client-react-streaming](https://github.com/apollographql/apollo-client-integrations/tree/main/packages/client-react-streaming) package to stream data dynamically while it is fetching, without requiring a first render pass with `prerenderStatic`.
225
+
If you are only using suspenseful hooks (like `useSuspenseQuery` or `useBackgroundQuery`) and no `useQuery` hooks, is also possible to use the [@apollo/client-react-streaming](https://github.com/apollographql/apollo-client-integrations/tree/main/packages/client-react-streaming) package to stream data dynamically while it is fetching, without requiring a first render pass with `prerenderStatic`.
226
226
You can find an example application that uses this approach in the [integration tests for that package](https://github.com/apollographql/apollo-client-integrations/tree/main/integration-test/vite-streaming).
0 commit comments