Skip to content
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

[Emotion] Squash :first-child/:nth-child errors #5920

Merged
merged 2 commits into from
May 24, 2022

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented May 23, 2022

Summary

Emotion throws a bunch of errors for the :first-child and :nth-child selectors for SSR reasons: emotion-js/emotion#1105

This PR silences those errors on Jest (db0b25a, see emotion-js/emotion#1105 (comment)) which absolutely do not need them, and also silences them in the browser (1378d1a, emotion-js/emotion#1105 (comment) - dev-recommended option)

Checklist

No changelog as technically this does not affect any source code

- since Jest is neither SSR or browser rendering, it really doesn't need to care about these errors
- these only appear in non-prod environments, but it's probably worth silencing them for non-SSR usage
@cee-chen cee-chen requested a review from thompsongl May 23, 2022 18:41
@cee-chen cee-chen marked this pull request as ready for review May 23, 2022 18:41
@@ -32,6 +32,7 @@ const cache = createCache({
key: 'myApp',
container: document.querySelector('meta[name="emotion-style-insert"]'),
});
cache.compat = true;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thompsongl this is used in our demo JS example - do we want consumers to copy this .compat = true code or no? It's possible some consumers may be on SSR and actually want the warning?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can leave this in. Even with SSR the warnings aren't helpful.

@cee-chen cee-chen mentioned this pull request May 23, 2022
7 tasks
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5920/

@cee-chen
Copy link
Member Author

cee-chen commented May 23, 2022

Just realized this is hard to test without any existing usage of :first-child in EUI. This might be better tested in #5895 / https://eui.elastic.co/pr_5895/#/display/text since that PR contains both this fix as well as a usage of :first-child

@cee-chen
Copy link
Member Author

cee-chen commented May 24, 2022

@thompsongl Any chance you can take a look at this today? #5895 needs/has it, but if #5895 lands first than this PR is kinda moot :)

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Constance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants