-
-
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
Shallow routing does not work #1023
Comments
@isaachinman If i18next/react-i18next#1273 gets merged there is still a little problem why shallow routing does not work for next-i18next. When using shallow routing then
|
Sure, that looks reasonable. |
* Memoize the i18n client and do not re-create it unless the route or locale has changed (fix i18next#1059). * Let Next's router locale take precedence over initialLocale (fix i18next#1023). * Bump the minimum version of react-i18next.
* Memoize the i18n client and do not re-create it unless the route or locale has changed (fix i18next#1059). * Let Next's router locale take precedence over initialLocale (fix i18next#1023). * Bump the minimum version of react-i18next.
* Memoize the i18n client and do not re-create it unless the route or locale has changed (fix i18next#1059). * Let Next's router locale take precedence over initialLocale (fix i18next#1023). * Bump the minimum version of react-i18next.
* Memoize the i18n client and do not re-create it unless the route or locale has changed (fix i18next#1059). * Let Next's router locale take precedence over initialLocale (fix i18next#1023). * Bump the minimum version of react-i18next.
* Memoize the i18n client and do not re-create it unless the route or locale has changed (fix i18next#1059). * Let Next's router locale take precedence over initialLocale (fix i18next#1023). * Bump the minimum version of react-i18next.
* Memoize the i18n client and do not re-create it unless the route or locale has changed (fix i18next#1059). * Let Next's router locale take precedence over initialLocale (fix i18next#1023). * Bump the minimum version of react-i18next.
This comment has been minimized.
This comment has been minimized.
* Memoize the i18n client and do not re-create it unless the route or locale has changed (fix i18next#1059). * Let Next's router locale take precedence over initialLocale (fix i18next#1023). * Bump the minimum version of react-i18next.
* Memoize the i18n client and do not re-create it unless the route or locale has changed (fix i18next#1059). * Let Next's router locale take precedence over initialLocale (fix i18next#1023). * Bump the minimum version of react-i18next.
Did this fix really solve completely the issue ? |
@csinig In |
@isaachinman Yes we are aware of that, implementation has changed and we already have adapted the code to use the nextJs router. |
@medihack Can you confirm if this issue is now resolved? |
@isaachinman I can't say for sure as I am currently using a custom solution in the app I am creating. I could test it, but I will need some time. But just looking at the code it should work. |
Sure, feel free to investigate and let me know if we need to reopen this. |
@isaachinman This issue still persists. Pls reopen it.
did not update the language, unless i remove the shallow. // next-i18next.config.js
Hi, Could you sharing whats the custom solution about? |
@liho00 Did |
@isaachinman i dont think its an issue with nextjs. We faced the same issue as @liho00 and just ended up switching to next-translate witch just works fine with shallow |
From the docs:
If anyone wants to work on a PR for shallow routing support, it would be much appreciated. |
I suppose we can consider this a duplicate of #1532. |
Is there any workaround to fix this until it gets fixed? |
Describe the bug
When switching the location with shallow routing option (using the Link or Router) it is not working (language does not switch).
Occurs in next-i18next version
Cloned from master branch (8.0.6).
Steps to reproduce
Simply add
shallow={true}
to the Link component in the example appExpected behaviour
Change of language should also work with shallow routing
OS (please complete the following information)
Additional context
I can explain why this happens. With the current implementation of next-i18next the i18n instance is always completely replaced. The problem is that the
t
function ofuseTranslation
is cached. So, if the components do not get recreated but just rerendered (as in shallow routing) thet
is the old cached one even if theI18nextProvider
has already a new i18n instance.The text was updated successfully, but these errors were encountered: