docs: Clarify when useSearchParams boundaries render on the server with Cache Components (#100276)
## Summary The `useSearchParams` docs say a prerendered route client-renders the tree up to the closest `<Suspense>` boundary. With Cache Components, that only holds when the rest of the route is prerendered. If any component on the route reads request data, such as `cookies()`, the postponed boundary is rendered on the server at request time with the real search params. Code inside it then runs on the server, and browser-only reads in render cause hydration mismatches. - `docs/01-app/03-api-reference/04-functions/use-search-params.mdx`: In Prerendering, state when the boundary is server-rendered under Cache Components, and point to `use(browser())` for browser-only components. - `errors/blocking-prerender-client-hook.mdx`: The Trade-off section said the fallback always swaps after hydration. Qualify it to routes where the rest is prerendered, and point to `use(browser())` for the request-time case. - `docs/01-app/02-guides/instant-navigation.mdx`: "suspends during server rendering" to "suspends during prerendering". Left unchanged: `errors/missing-suspense-with-csr-bailout.mdx`, which describes the non-Cache Components model and is accurate there. Finding: https://next-maintainer-agent.vercel.tools/agent-feedback/2121 ## Verification Production build on `next@16.4.0-canary.37` with `cacheComponents: true`, `curl "/<route>?q=hello"`: | Route | `useSearchParams` boundary in server HTML | | --- | --- | | Rest of the route prerendered | No, fallback only | | `cookies()` in a sibling `<Suspense>` | Yes, with `hello` | | `cookies()` awaited above the component | Yes, with `hello` | | Sibling `cookies()`, component calls `use(browser())` | No, sibling still streams | Matches `app-render.tsx`: a complete server result resumes and aborts postponed HTML boundaries into client render mode, a partial one saves postponed state for the request-time resume. Only `useSearchParams` was tested; the error page Trade-off covers the other URL hooks on the same code path. <!-- NEXT_JS_LLM -->
Showing
Please
register
or
sign in
to comment