[Emotion] Allow configuring style memoization error/warning level#7626
Merged
cee-chen merged 5 commits intoelastic:mainfrom Mar 27, 2024
Merged
[Emotion] Allow configuring style memoization error/warning level#7626cee-chen merged 5 commits intoelastic:mainfrom
cee-chen merged 5 commits intoelastic:mainfrom
Conversation
- via our existing `emitEuiProviderWarning` utility
- but not on prod/staging, in case of false negatives
+ fix EuiProvider demo not working since the organization changes - ID follows title
3d9356c to
c85cf00
Compare
5 tasks
mgadewoll
reviewed
Mar 27, 2024
Co-authored-by: Lene Gadewoll <lene.gadewoll@elastic.co>
mgadewoll
approved these changes
Mar 27, 2024
Contributor
mgadewoll
left a comment
There was a problem hiding this comment.
🚢 🐈⬛ LGTM!
Staging works as expected as far as I can see and I also checked it locally based on the issue encountered on #7625 making sure that locally an error is thrown or a warning is printed to the console if an anonymous function is passed to useEuiMemoizedStyles.
Nice solution using setEuiDevProviderWarning 🎉 (also TIL that it exists! 🧠)
Contributor
Author
There are so many random little utilities in EUI that make me say that 😂 |
|
Preview staging links for this PR:
|
Collaborator
💚 Build Succeeded
History
|
cee-chen
added a commit
to elastic/kibana
that referenced
this pull request
Apr 1, 2024
`v93.5.1` ⏩ `v93.5.2` --- ## [`v93.5.2`](https://github.com/elastic/eui/releases/v93.5.2) **Dependency updates** - Updated `react-virtualized-auto-sizer` to 1.0.24 ([#7598](elastic/eui#7598)) - Updated `react-window` to 1.8.10 ([#7600](elastic/eui#7600)) **CSS-in-JS conversions** - Updated EUI's internal style memoization/performance utility to have configurable error/warning levels via `setEuiDevProviderWarning` ([#7626](elastic/eui#7626))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The catch I added in #7529 (comment) has backfired, in that it's producing a false negative on staging (but not local??) in #7625 (review).
To work around prod false negatives but preserve the intended goal of catching anonymous style functions in development, I'm tweaking the thrown error to use our internal EUI provider warning utility, which allows us (and consumers) to configure the warning level used. In this case, I'm setting it to
errorfor local docs dev and for storybook, but to justwarnfor staging/prod.As always, I recommend following along by commit.
QA
I think QA is already pretty well covered by our tests, so IMO a brief smoke check of staging to ensure no errors is sufficient. Here are the extra QA steps I took locally:
EuiProviderin app_context.js to confirm the expected error threwEuiProviders to confirm the expected error threwGeneral checklist
Added orupdated jestand cypress tests- [ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)