-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[regression] ReactDOM.render calls need Render context in deprecated component #163137
[regression] ReactDOM.render calls need Render context in deprecated component #163137
Conversation
Pinging @elastic/eui-team (EUI) |
Pinging @elastic/appex-sharedux (Team:SharedUX) |
/** The `I18nStart` API from `CoreStart`. */ | ||
i18n: I18nStart; | ||
i18n?: I18nStart; |
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.
@cee-chen I'm not convinced this is the right way to handle the deprecation. We might consider your detect-warn-and-resolve approach.
💔 Build FailedFailed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
HistoryTo update your PR or re-run it, just comment with: |
Closing in favor of merging some changes to the alternative detection method. |
Summary
There's currently a regression when using the deprecated
KibanaThemeProvider
fromkibana_react
andkibana_utils
.The design for context use moving forward would be that we would use the
Root
context once, theRender
context for out-of-band renders, and theTheme
provider when adjusting the theme.The mistake I made was deprecating the existing
KibanaThemeProvider
and mapping it directly to the new Theme context. My plan was to follow up and update all of theReactDOM.render
calls to use the Render provider, and believed my deprecation to be passive. It was, but not in all cases.Until we can update all of our
ReactDOM.render
calls to use the correct context, we need to have the deprecated provider use the Render context. This will return us to the status quo until applications can make the change.This PR also fixes an oversight where the Render provider still needs to utilize the
EuiProvider
, just not with the global styles. @cee-chen and I had several conversations clarifying which contexts were needed in each case, and it wasn't until we saw this issue that we realized we hadn't clarified enough. :-)The good news is that @cee-chen and EUI are going to be working on their documentation and provider APIs to make the distinction easier. Even better news is, with these contexts, we can abstract any updates away from Kibana code. So all-in-all, we're still in a better position than when we started.
Next steps
ReactDOM.render
to use theKibanaRenderContextProvider
.QA
Previous/broken behavior
<head>
<meta name="emotion">
, you'll only see a couple hundred style nodes:<head>
, you should see a lot of<style data-emotion="css">
nodes:Fixed behavior in this PR
<head>
<meta name="emotion">
, you should now see well over thousands of styles<style data-emotion="css">
with EUI styles at the end of the head (there's a lot of<script>
tags instead). There's still a few, but they appear to not be EUI styles (e.g. it's a plugin's random Emotion styles that they're using without a cache set up).