Skip to content

[Emotion][perf] Memoize loading components#7649

Merged
cee-chen merged 4 commits intoelastic:mainfrom
cee-chen:emotion/memoization-loading
Apr 4, 2024
Merged

[Emotion][perf] Memoize loading components#7649
cee-chen merged 4 commits intoelastic:mainfrom
cee-chen:emotion/memoization-loading

Conversation

@cee-chen
Copy link
Copy Markdown
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 added skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) tech debt emotion performance labels Apr 3, 2024
@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
Copy Markdown

Preview staging links for this PR:

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

@tkajtoch tkajtoch self-requested a review April 4, 2024 11:46
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

cee-chen commented Apr 4, 2024

Thanks Tomasz!

@cee-chen cee-chen merged commit bed1865 into elastic:main Apr 4, 2024
@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

Labels

emotion performance skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants