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

refactor: Set config.react.useSuspense to false #1530

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

isaachinman
Copy link
Contributor

Fixes #1255

cc @adrai – following up on your comment: #1255 (comment)

We are already awaiting the initialisation promise inside serverSideTranslations here.

The reason you have to manually list your namespaces in your demo project here is because they are not present in your filesystem, which we normally query for automatically.

Let me know if you think this looks like a safe change 👍

@vercel
Copy link

vercel bot commented Nov 16, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/isaachinman/next-i18next/FrtVeK9W77XP8FLA9LbhATotHzpU
✅ Preview: https://next-i18next-git-use-suspense-false-isaachinman.vercel.app

@adrai
Copy link
Member

adrai commented Nov 16, 2021

This is ok, just the default options anyway....
Maybe there should be a hint somewhere, when using a "remote" backend either the ready flag needs to be checked before calling the t() function or the namespaces needs to be listed in the ns option to be proloaded on init

@isaachinman
Copy link
Contributor Author

Yeah, good point. We could add it to this section. Although, is that statement exactly correct?

The namespaces will need to be listed either way. If you await the ready flag without passing namespaces, the instance will be "ready" but without any content, right?

@adrai
Copy link
Member

adrai commented Nov 16, 2021

Yes, that section should be ok.

the i18next instance is always ready after initialization, but if the namespaces where not listed in the ns option, they are not loaded on init, but on request (i.e. useTranslation) and this means they are loaded asynchronous, that's why the ready flag has to be checked...

@isaachinman
Copy link
Contributor Author

But, the ready flag cannot be checked arbitrarily during React render (when the useTranslation hook is invoked)... Unless I am misunderstanding?

@adrai
Copy link
Member

adrai commented Nov 16, 2021

But, the ready flag cannot be checked arbitrarily during React render (when the useTranslation hook is invoked)... Unless I am misunderstanding?

What do you exactly mean by this? Here an example: https://github.com/i18next/react-i18next/blob/2bd69a2cc638acfafb37dc0c56db6add4e9dac85/test/typescript/examples.test.tsx#L59

@isaachinman
Copy link
Contributor Author

Ah, I see what you mean. Thanks for explaining. Would you have a moment to write this up for the next-i18next docs?

@isaachinman isaachinman merged commit 93d4f88 into master Nov 16, 2021
@isaachinman isaachinman deleted the use-suspense-false branch November 16, 2021 10:50
@adrai
Copy link
Member

adrai commented Nov 16, 2021

Ah, I see what you mean. Thanks for explaining. Would you have a moment to write this up for the next-i18next docs?

I'm not that good in english, but I will try in the next hours...

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.

"ReactDOMServer does not yet support Suspense." - message on projects start on nextjs
2 participants