-
-
Notifications
You must be signed in to change notification settings - Fork 766
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
"ReactDOMServer does not yet support Suspense." - message on projects start on nextjs #1255
Comments
Have you debugged the issue? What is using suspense, thus causing the error? Most likely this is simply user error, and you just need to modify values in your i18next config. |
In console I see same error as described and another weird message: i18next: init: i18next is already initialized. You should call init just once! The code itself not complicate |
also it seems like it could be reproduced only on server start, on page refresh it won't appear |
@isaachinman maybe you know which value I can try to modify in config? Because I've try a lot of them before and nothing help... |
I am getting the same error but it does not go away on page reload in my case. I have followed all the steps from the docs. This error comes up when I call |
I've been experiencing this as well. Updated to the latest versions and it's still reproducing. Just to make sure, are there any known issues with next 10.2.x? |
Could be a duplicate of #1202. |
@isaachinman Not related to the issue. The OP of this thread is experiencing this problem with both Webpack 4 and Webpack 5. The issue you linked is related to Webpack 5 not transpiling a file incorrectly loaded via |
I encountered this issue today as well. I was able to solve it by adding the following build settings to my
I found the solution in the NextJS Github repository issues section here: vercel/next.js#22508 (comment) |
@jamuhl @adrai What is the expected value for |
When translations are loaded asynchronously (i.e. when using i18next-http-backend or any other async backend) react-i18next (since v10) by default assumes you can use Suspense. If Suspense can't be used, you need to set useSuspense to false. Since it seemed Suspense was not supported in SSR apps, this was the advice we've written in the react-i18next documentation: https://react.i18next.com/latest/ssr#passing-initial-translations-initial-language-down-to-client btw: to avoid a Suspense trigger, all translations can also be "preloaded" on init. That's why here we've listed all namespaces: https://github.com/locize/next-i18next-locize/blob/main/next-i18next.config.js#L17 |
@adrai We recommend users declare namespaces per-page. Is there any drawback to |
If the namespaces (and languages) are not preloaded (defined) on init(), they will be lazy loaded, this will trigger a suspense or if not using Suspense, the user needs to check the ready flag, else the translations will not be ready to be rendered... |
PROBLEM: In my case the issue was that i didn't have any locale.json referring to the locale I was loading in serverSideTranslations. I know it's kind of dumb but maybe someone may find this helpful. |
Fixed it by using the correct namespace I was doing:
Instead of:
Which is the same as:
|
🐛 Bug Report
On start nextjs shows error with next text:
"ReactDOMServer does not yet support Suspense."
And after a two seconds it is renders the page with correct translation.
Screen of error:
To Reproduce
Test translation files serves with http-server
There is a code example on code sandbox:
example
the structure on a server is next:
| - header.json
| - header.json
| - header.json
translation file content (header.json)
next-i18next.config.js
next.config.js
_app.tsx
page.tsx
TargetComponent.tsx
Expected behavior
The possibility to use backend stored translations with
next-i18next
,i18next-http-backend
andi18next-chained-backend
without "Suspense" error.Environment
The text was updated successfully, but these errors were encountered: