Skip to content
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

Docs: Clarify useSearchParams behavior #60257

Merged
merged 2 commits into from
Jan 5, 2024
Merged

Docs: Clarify useSearchParams behavior #60257

merged 2 commits into from
Jan 5, 2024

Conversation

delbaoliveira
Copy link
Contributor

@delbaoliveira delbaoliveira commented Jan 5, 2024

  • useSearchParams opts the client component subtree out of static rendering (pre-rendering), not dynamic rendering. We recommend wrapping the component that uses useSearchParams in a Suspense boundary to allow client components above it to be statically rendered (part of the initial HTML).

Closes: https://vercel.slack.com/archives/C03S9JCH2Q5/p1704398859737719

@delbaoliveira delbaoliveira requested review from a team as code owners January 5, 2024 11:18
@delbaoliveira delbaoliveira requested review from leerob and molebox and removed request for a team January 5, 2024 11:18
Copy link
Contributor

github-actions bot commented Jan 5, 2024

All broken links are now fixed, thank you!

@delbaoliveira delbaoliveira changed the title Docs: Clarify useSearchParams behavior Docs: Clarify useSearchParams behavior Jan 5, 2024
Copy link
Member

@leerob leerob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@leerob leerob merged commit 052006b into canary Jan 5, 2024
33 checks passed
@leerob leerob deleted the docs-i7dg branch January 5, 2024 13:58
@@ -525,7 +525,7 @@ See the [`revalidatePath` API reference](/docs/app/api-reference/functions/reval

### Dynamic Functions

`cookies`, `headers`, `useSearchParams`, and `searchParams` are all dynamic functions that depend on runtime incoming request information. Using them will opt a route out of the Full Route Cache, in other words, the route will be dynamically rendered.
Dynamic functions like `cookies` and `headers`, and the `searchParams` prop in Layouts and Pages depend on runtime incoming request information. Using them will opt a route out of the Full Route Cache, in other words, the route will be dynamically rendered.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: searchParams is not passed to Layouts

agustints pushed a commit to agustints/next.js that referenced this pull request Jan 6, 2024
- `useSearchParams` opts the client component subtree out of static
rendering (pre-rendering), not dynamic rendering. We recommend wrapping
the component that uses `useSearchParams` in a Suspense boundary to
allow client components above it to be statically rendered (part of the
initial HTML).

Closes: https://vercel.slack.com/archives/C03S9JCH2Q5/p1704398859737719
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants