Skip to content

Conversation

@cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Mar 27, 2024

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 error for local docs dev and for storybook, but to just warn for 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:

  • Removed EuiProvider in app_context.js to confirm the expected error threw
  • Nested/duplicated EuiProviders to confirm the expected error threw
  • Changed an arbitrary style function to an anonymous fn to confirm the expected error threw

General checklist

  • Browser QA - N/A
  • Docs site QA - N/A
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
      - [ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist - N/A

- 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
@cee-chen cee-chen changed the title [Emotion] Allow style memoization error/warning level to be configured [Emotion] Allow configuring style memoization error/warning level Mar 27, 2024
@cee-chen cee-chen force-pushed the emotion/memoization-map-error branch from 3d9356c to c85cf00 Compare March 27, 2024 18:35
@cee-chen cee-chen marked this pull request as ready for review March 27, 2024 18:37
@cee-chen cee-chen requested a review from a team as a code owner March 27, 2024 18:37
Co-authored-by: Lene Gadewoll <lene.gadewoll@elastic.co>
Copy link
Contributor

@mgadewoll mgadewoll left a comment

Choose a reason for hiding this comment

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

🚢 🐈‍⬛ 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! 🧠)

@cee-chen
Copy link
Contributor Author

also TIL that it exists!

There are so many random little utilities in EUI that make me say that 😂

@cee-chen cee-chen enabled auto-merge (squash) March 27, 2024 19:33
@kibanamachine
Copy link

Preview staging links for this PR:

@cee-chen cee-chen merged commit eb925fd into elastic:main Mar 27, 2024
@cee-chen cee-chen deleted the emotion/memoization-map-error branch March 27, 2024 20:12
@elasticmachine
Copy link
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))
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.

4 participants