Skip to content

[EuiSideNav] Memoize mobile styles - #10241

Merged
angeles-mzb merged 1 commit into
elastic:mainfrom
florianaltendorfer:bounty-10164
Oct 29, 2026
Merged

angeles-mzb merged 1 commit into
elastic:mainfrom
florianaltendorfer:bounty-10164

Conversation

@florianaltendorfer

Copy link
Copy Markdown
Contributor

Summary

Closes #10164.

EuiSideNav now gets its mobile styles through useEuiMemoizedStyles(euiSideNavMobileStyles) instead of calling the generator with the theme on every render. euiSideNavMobileStyles only depends on the theme, so it can be memoized as-is, and the now unused useEuiTheme call is removed. side_nav_item.tsx was already memoized. No changelog per the issue.

Tested with yarn test-unit side_nav (snapshots unchanged), tsc and eslint on the changed file.

API Changes

component / parent prop / child change description

Impact Assessment

  • 🔴 Breaking changes
  • 💅 Visual changes
  • 🧪 Test impact
  • 🔧 Hard to integrate

Impact level: 🟢 None

Release Readiness

  • Documentation
  • Figma
  • Migration guide
  • Adoption plan

QA instructions for reviewer

  • Open the EuiSideNav mobile story in Storybook, toggle the mobile menu, and confirm it opens and closes as before.

Checklist before marking Ready for Review

  • Filled out all sections above
  • QA: Tested light/dark modes, high contrast, mobile, Chrome/Safari/Edge/Firefox, keyboard-only, screen reader
  • QA: Tested in CodeSandbox and Kibana
  • QA: Tested docs changes
  • Tests: Existing Jest tests pass
  • Changelog: Added changelog entry
  • Breaking changes: Added breaking change label (if applicable)

@florianaltendorfer
florianaltendorfer requested a review from a team as a code owner October 24, 2026 20:56
Copilot AI balanced review requested due to automatic review settings October 24, 2026 20:56
@cla-checker-service

cla-checker-service Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

💚 CLA has been signed

@github-actions

Copy link
Copy Markdown

👋 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?

@github-actions github-actions Bot added the community contribution (Don't delete - used for automation) label Oct 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The theme-only style generator fits the memoization hook’s contract, and mobile state-dependent behavior remains unchanged.

No open issues 🎉

What changed in this PR

Memoizes EuiSideNav mobile styles using the existing theme-aware hook, addressing #10164 without changing mobile menu behavior.

Changes:

  • Replaces direct style generation with useEuiMemoizedStyles(euiSideNavMobileStyles).
  • Removes the unused useEuiTheme import and call.
File Description
packages/​eui/​src/​components/​side_nav/​side_nav.tsx Uses memoized mobile styles and removes the redundant theme lookup.

Review effort: Balanced

@florianaltendorfer

Copy link
Copy Markdown
Contributor Author

I've signed the contributor agreement.

@angeles-mzb
angeles-mzb self-requested a review October 29, 2026 08:31
@angeles-mzb

Copy link
Copy Markdown
Contributor

buildkite test this

@angeles-mzb angeles-mzb added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Oct 29, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

@infra-vault-gh-plugin-prod

infra-vault-gh-plugin-prod Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

History

@angeles-mzb angeles-mzb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for contributing @florianaltendorfer!

@angeles-mzb
angeles-mzb merged commit 19afc66 into elastic:main Oct 29, 2026
11 of 12 checks passed
weronikaolejniczak pushed a commit to boriskirov/eui that referenced this pull request Nov 11, 2026
Co-authored-by: Florian Josef Altendorfer <341419330+florianaltendorfer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution (Don't delete - used for automation) skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Emotion] Memoize EuiSideNav styles

3 participants