diff --git a/docs/framework/react/guides/advanced-ssr.md b/docs/framework/react/guides/advanced-ssr.md index db9db2f9a2..9431be02e8 100644 --- a/docs/framework/react/guides/advanced-ssr.md +++ b/docs/framework/react/guides/advanced-ssr.md @@ -532,6 +532,25 @@ Now, your `getPosts` function can return e.g. `Temporal` datetime objects and th For more information, check out the [Next.js App with Prefetching Example](../examples/nextjs-app-prefetching). +### Using the Persist Adapter with Streaming + +If you're using the persist adapter with the [Streaming with Server Components](#streaming-with-server-components) feature, you need to be careful not to save promises to storage. Since pending queries can be dehydrated and streamed to the client, you should configure the persister to only persist settled queries: + +```tsx + + {children} + +``` + +This ensures that only successfully resolved or errored queries are persisted to storage, preventing serialization issues with pending promises. + ## Experimental streaming without prefetching in Next.js While we recommend the prefetching solution detailed above because it flattens request waterfalls both on the initial page load **and** any subsequent page navigation, there is an experimental way to skip prefetching altogether and still have streaming SSR work: `@tanstack/react-query-next-experimental`