Repository navigation
[EuiCard] Memoize theme styles - #10175
vianmangal wants to merge 4 commits into
Conversation
|
👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually? |
Co-authored-by: Cursor <cursoragent@cursor.com>
weronikaolejniczak
left a comment
There was a problem hiding this comment.
Thanks for contributing, @vianmangal! 🎉
There are 2 snapshots we'd have to update in Kibana so I pushed a prep commit to this PR.
📷 2 visual difference(s) foundLook at the visual diff below. If everything is expected, run Approve visual changes to update baselines, re-run the job or make appropriate fixes. See the visual regression testing wiki for more information. Expand to revieweuisuperdatepicker (2 differences)
|
Co-authored-by: Cursor <cursoragent@cursor.com>
|
buildkite test this |
weronikaolejniczak
left a comment
There was a problem hiding this comment.
Turns out the PR was out-of-date with main that already memoized this part. But it's worth memoizing 2 more styles here.
Head branch was pushed to by a user without write access
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|






Summary
Fixes #10152.
Use
useEuiMemoizedStylesfor the theme-only style generators inEuiCard,EuiCardSelect, andEuiCheckableCard. Extract the image, icon, and beta badge padding rules into a separate dynamic helper so cards with differentpaddingSizevalues can share the theme styles safely. Call the beta badge hook unconditionally so badges can be added or removed during rerenders.Add regression coverage for sharing theme styles across instances and rerenders, independent image/icon/badge padding at every nonzero padding size, and toggling beta badges. Update the two affected snapshots for the composed Emotion class labels.
No changelog, as requested by the issue.
API Changes
None.
Screenshots
No intended visual changes. Padding behavior is checked with CSS assertions; the snapshot changes only reflect composed Emotion class labels.
Impact Assessment
Impact level: 🟢 Low
Release Readiness
Documentation, Figma, migration guide, and adoption plan are not applicable to this internal performance refactor.
Validation
From
packages/eui:style_memoization.test.tsx— 70 tests passed; 50 snapshots passed.tsc --noEmit --incremental false --preserveSymlinks— passed.--preserveSymlinksis needed because this checkout reuses an existing installation with the identical Yarn lockfile through local dependency symlinks.card.styles.ts, Prettier on the changed source/test files, andgit diff --check— passed.QA instructions for reviewer
yarn test-unit --runInBand src/components/card src/services/theme/style_memoization.test.tsx.--react-version=17before the Jest arguments.none; confirm alignment and badge positioning remain consistent.Checklist before marking Ready for Review
Reviewer checklist