-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
I18nProvider
is not marked as "use client";
#7550
Comments
hmm if you import it through react-spectrum/packages/react-aria-components/src/index.ts Lines 13 to 15 in 50c7ada
Maybe we need to add that to our other mono packages? Not sure why it wouldn't work anymore... |
For prior context on why |
@devongovett Interesting, On a side note: The standard way to handle the hydration/serialization issue alluded to above around the events is either to wrap them in a Would there be interest in a contribution that updated the components to be RSC compatible? If so I'd love to work on a larger contribution to enable this. React-Aria is an incredible tool for building UI's for those with limited means and resources. Preventing SSR, while a cutting edge case now, can cause serious layout shift issues if the components are not rendered until after the page is loaded and the hydration step kicks in. Causing a terrible pitfall for users with motion or contrast accessibility concerns. At a high level for this contribution: While the |
I don't think it's optional either?
This does not work with RSC because
This is not the case. Client components are still SSRed to HTML, just like they were before RSCs. Server components only run on the server, whereas client components run on both the server and in the browser. What |
Ah that explains the format of the error! I misunderstood the details of the boundary. I understood My deepest apologies for the spammy ticket and may you have a great and relaxing holiday! |
Provide a general summary of the issue here
When rendering the
I18nProvider
into a server side rendering framework like NextJS App Router (Tan-stack Start and others are likely also effected) the following error occures:This is due to the component (and hooks) not being marked as a client component.
🤔 Expected Behavior?
The I18nProvider component should render as a client component. Allowing it to be initially rendered on the server and hydrated on the client and rendered as a wrapper within async Server Components.
😯 Current Behavior
React fails to render the component due to the Provider not being marked as a client component.
💁 Possible Solution
The quickest solution is to wrap the I18nProvider in a Higher Order Component (HOC) that contains a
'use-client'
tag in the header🔦 Context
I ran across this issue attempting to merge
react-aria
withnext-intl
to sync the accessible tags of the application with the language of the UI (English, Spanish, Arabic (RTL), and Chinese Simplifed for now 😄)Going forward as React Server components become more popular and the industry starts sending valid, internationalized HTML over the wire rather than constructing it on the client dynamically I think that supporting imports in SSR components would be valuable for the react-aria library.
🖥️ Steps to Reproduce
See the
context
above for a more in-depth example. However for a simple POC any create-next-app with the following file should do it:Version
1.5.0
What browsers are you seeing the problem on?
Other
If other, please specify.
NodeJS
What operating system are you using?
MacOS / Alpine Linux
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: