You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My issue is, that when I try to provide some default values for formatting the rich texts, like:
<NextIntlClientProviderlocale={params.locale}messages={messages}defaultTranslationValues={{// This function breaks the apphighlight: (text)=><strong>{text}</strong>,}}>{children}</NextIntlClientProvider>
then I got that error:
Error: Functions cannot be passed directly to Client Components because they're not serializable.
Is this issue might have been resolved already using the next-intl@2.11.0-beta.4 version?
Try to pass some value to the defaultTranslationValues prop of the NextIntlClientProvider component.
The app's gonna crash
Expected behaviour
The app should not crash because of this, instead it should render the rich text message. If that's not possible because the nature of the server components, then it should provide a fallback value or remove this props and it's type declarations when using the app folder structure.
The text was updated successfully, but these errors were encountered:
thanks for the report! That's an expected error, React can not serialize functions like defaultTranslationValues when you pass them to a Client Component.
I'm not sure yet how much information next-intl needs to provide in regards to this, as this is a general Next.js/React topic. Next.js already has a small section in regards to this. Furthermore with the Server Components integration I think there'll be less need for this pattern.
Description
Hello there!
My issue is, that when I try to provide some default values for formatting the rich texts, like:
then I got that error:
Is this issue might have been resolved already using the
next-intl@2.11.0-beta.4
version?Reproduction URL (CodeSandbox)
https://codesandbox.io/p/sandbox/next-intl-bug-template-forked-6jfg9x?file=%2Fsrc%2Fapp%2F%5Blocale%5D%2Flayout.tsx&selection=%5B%7B%22endColumn%22%3A38%2C%22endLineNumber%22%3A30%2C%22startColumn%22%3A38%2C%22startLineNumber%22%3A30%7D%5D
Reproduction description
next-intl
based on the documentation..defaultTranslationValues
prop of theNextIntlClientProvider
component.Expected behaviour
The app should not crash because of this, instead it should render the rich text message. If that's not possible because the nature of the server components, then it should provide a fallback value or remove this props and it's type declarations when using the app folder structure.
The text was updated successfully, but these errors were encountered: