-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Modify I18nProvider so that it does not generate new React components #43556
Modify I18nProvider so that it does not generate new React components #43556
Conversation
new React components.
💔 Build Failed |
Pinging @elastic/kibana-stack-services |
Using this PR I can't render the login page anymore (and I assume nothing else either, since I can't get anywhere in Kibana) when using the pseudo locale, because I am getting the following exception:
Since it seems that CI didn't run into that issue, any idea what it could be? I ran |
I think the code change makes sense, I will pull this locally later on tonight to play around with it. |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works, LGTM
} | ||
|
||
/** | ||
* If the locale is our pseudo locale (e.g. en-xa), we override the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for documenting this 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I like this change :D
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
While developing Lens, we noticed the app went into an infinite loop when we ran Kibana with the pseudo locale:
yarn start --i18n.locale=en-xa
The reason seems to be that the i18n provider generates a React component when a pseudo locale is used. This generated component appears to cause the React diffing logic to think that it is looking at a brand new tree, and so useState, useEffect, etc are all reset. This didn't surface elsewhere because the rest of Kibana uses only a single root I18nProvider, whereas Lens uses several nested ones due to the fact that Lens plugins don't require React, so any Lens plugin that actually makes use of React ends up instantiating its own I18nProvider, and may contain other nested plugins which themselves have their own I18nProviders.