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

feat!: Automatically inherit formats when NextIntlClientProvider is rendered from a Server Component #1191

Merged
merged 5 commits into from
Aug 26, 2024

Conversation

amannn
Copy link
Owner

@amannn amannn commented Jul 11, 2024

This should ease the transition from Server to Client Components, as you don't have to manually pass this prop anymore. If you've previously passed this prop manually, you can remove this assignment now.

If this is not desired (e.g. because you have a large formats object that you don't want to pass to the client side), you can manually opt-out via formats={{}} on NextIntlClientProvider in order to not provide any formats on the client side.

BREAKING CHANGE: There's a very rare chance where this can break existing behavior. If you're rendering NextIntlClientProvider in a Server Component, you rely on static rendering, but you're not using unstable_setRequestLocale (i.e. you're using hooks like useTranslations exclusively in Client Components), this can opt your page into dynamic rendering. If this affects you, please provide the formats prop explicitly to NextIntlClientProvider.

Copy link

vercel bot commented Jul 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 23, 2024 10:45am
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 23, 2024 10:45am
next-intl-example-app-router-without-i18n-routing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 23, 2024 10:45am

…ard-formats

# Conflicts:
#	docs/pages/docs/environments/server-client-components.mdx
#	packages/next-intl/package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant