-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
t
is not refreshed when keyPrefix
is changed
#1542
Comments
Would you like to send a Pull Request to address this? |
Sure, i'd love to. |
I couldn't create a new branch though. |
try to solve it like this: 47d9670 |
I'm trying to understand why If the |
🐛 Bug Report
I wanted to use a dynamic
keyPrefix
in my component to support an A/B test we're running on the copy of a component.When the component mounts, i fetch a new variant for the current user and so in the initial render, the
keyPrefix
is suffixed with anundefined
that resolves to one of my variants as soon as the fetch is successful, way before the component is ever rendered on screen.To Reproduce
codesandbox
Expected behavior
useTranslation
should resett
when keyPrefix changes and reflect the newkeyPrefix
The solution is simple:
Add
keyPrefix
to the dependency array of the useEffect starting in line 99 inuseTranslation.js
so thatt
is reset wheneverkeyPrefix
changes.Your Environment
The text was updated successfully, but these errors were encountered: