-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
🐛 Bug Report
I use the I18nextProvider
to distribute the i18n instance in a Blitz.js app with SSR. When switching the language I simply replace the i18n instance in the provider (this is also how next-i18next works). This works when recreating every component, but breaks when just rerendering every component. It is because t
of useTranslation
is cached.
This also breaks next-i18next when using shallow routing. And it is not only a problem with shallow routing, but also with persistent layouts as those components in the layout (like app bars) are also not translated correctly after a page change (and replacing the i18n instance).
To Reproduce
Replace the i18n instance of a I18nextProvider
and just force a rerender of all components that use the useTranslation
hook. I also demonstrated this with a little code change in the example app of next-i18next (https://github.com/medihack/next-i18next).
Expected behavior
The useTranslation
hook should somehow check if its provided i18n instance was replaced and not just provide a cached t
function.
Your Environment
- runtime version: node v15.5
- i18next version: 11.8.8
- os: Windows WSL