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!: Inherit context in case nested NextIntlClientProvider instances are present #1413

Merged
merged 4 commits into from
Oct 9, 2024

Conversation

amannn
Copy link
Owner

@amannn amannn commented Oct 9, 2024

If you have nested providers, previously only the configuration of the innermost one would be applied.

With this change, configuration is now passed from one provider to the next, while allowing to override individual props. This simplifies the configuration of onError and getMessageFallback if you're using those (see proposed docs).

Breaking change: There's a very rare chance that this change affects your app, but in case you've previously relied on providers not inheriting from each other, you now have to reset props manually in case you want to retain the previous behavior.

Copy link

vercel bot commented Oct 9, 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 Oct 9, 2024 5:36pm
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 5:36pm
next-intl-example-app-router-without-i18n-routing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 5:36pm

messages: messages || prevContext?.messages,
now: now || prevContext?.now,
onError: onError || prevContext?.onError,
timeZone: timeZone || prevContext?.timeZone
Copy link
Owner Author

Choose a reason for hiding this comment

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

Doesn't minify terribly well, but can't really think of a better solution …

@amannn amannn mentioned this pull request Oct 9, 2024
6 tasks
@amannn amannn changed the title feat: Inherit context feat: Inherit context between providers Oct 9, 2024
@amannn amannn merged commit d80d691 into v4 Oct 9, 2024
9 checks passed
@amannn amannn deleted the feat/inherit-context branch October 24, 2024 13:31
@amannn amannn changed the title feat!: Inherit context between providers feat!: Inherit context in case multiple NextIntlClientProvider ancestors are present Oct 31, 2024
@amannn amannn changed the title feat!: Inherit context in case multiple NextIntlClientProvider ancestors are present feat!: Inherit context in case nested NextIntlClientProvider instances are present Oct 31, 2024
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