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][perf] Memoize loading components #7649

Merged
merged 4 commits into from
Apr 4, 2024

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Apr 3, 2024

Summary

Part of #7561 efforts

This PR:

  • Memoizes all EuiLoading* components
  • Refactors how EuiLoadingChart styles are written/generated to use static :nth-child CSS instead of dynamic JS styles (98ebe26). Also removes its --mono className modifier - no usages in Kibana
  • All other components were fairly straightforward

QA

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes. Also checked with Reduced motion setting
  • Docs site QA - N/A
  • Code quality checklist - N/A, all tests should pass
  • Release checklist - N/A, skipping a changelog as this is mostly tech debt and shouldn't affect either consumers or end-users
  • Designer checklist - N/A

cee-chen added 4 commits April 3, 2024 12:22
- not memoizing the inline style - usage is fairly low / it's not worth it
+ add story for easier testing
- it's not super complex, so just pair it with the main styles
- doesn't need theme tokens so can just be a static obj
- prefer static nth-child CSS over a dynamically generated function (since it's not like the bar count is customizable via prop)

- inline the bar JSX and replace for loop with Array.from

+ fix the duplicate loading i18n (should be using the shared string with the same copy)
@cee-chen cee-chen marked this pull request as ready for review April 3, 2024 20:25
@cee-chen cee-chen requested a review from a team as a code owner April 3, 2024 20:25
@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

@tkajtoch tkajtoch self-requested a review April 4, 2024 11:46
Copy link
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

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

Changes look and work great!

@cee-chen
Copy link
Contributor Author

cee-chen commented Apr 4, 2024

Thanks Tomasz!

@cee-chen cee-chen merged commit bed1865 into elastic:main Apr 4, 2024
16 of 17 checks passed
@cee-chen cee-chen deleted the emotion/memoization-loading branch April 4, 2024 15:48
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