-
-
Notifications
You must be signed in to change notification settings - Fork 763
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
Memoization of server side instance causes pages to be rendered in the wrong language #1063
Comments
Hit the same today. I can also confirm this issue. Temporary workaround is downgrading and pinning |
cc @adrai |
I have not much Next.js knowledge, so I don't know why this warning exactly occurs. |
@skrivanos @sigo I was not able to reproduce the warning with my PR can you also confirm? |
@adrai Seems to work, however I'm not sure I'm a fan of creating a new instance each request. I tried this
Which seems to have done the trick as well... Are there any downsides to this? Edit: |
creating a clone on every request was also done when used i18next-http-middleware in older versions of next-i18next... |
@skrivanos I'm in favour of cloning, as I'm not sure how @adrai Is the entire point of cloning vs |
yes |
We were experiencing the same problem on The server did cache the language initially, so the first language to be shown was always the initial one on SSR. The option |
Describe the bug
Pages are only rendered in one language on the server when using getServerSideProps OR when using the dev server with getStaticProps.
Caused by:
https://github.com/isaachinman/next-i18next/blob/c6fc2e3bdbee07b53cb4a0871cf1abcd372c7b26/src/createClient/node.ts#L9-L11
Added in commit:
e7c5fad
Occurs in next-i18next version
8.1.1
Steps to reproduce
Run example/simple, click switch locale and reload the page.
Expected behaviour
To use the correct locale.
Screenshots
Additional context
This doesn't cause issues in production when using
getStaticProps
because the translations are stored upon build, but it messes up pages using getServerSideProps (they will always render in whatever language the i18n instance was firstly created as).The text was updated successfully, but these errors were encountered: