-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat(nav): Display secondary nav in mobile menu #84582
Conversation
const value = useMemo( | ||
() => ({secondaryNavEl, setSecondaryNavEl}), | ||
[secondaryNavEl, setSecondaryNavEl] | ||
() => ({ | ||
secondaryNavEl, | ||
setSecondaryNavEl, | ||
layout: isMobile ? NavLayout.MOBILE : NavLayout.SIDEBAR, | ||
isCollapsed, | ||
setIsCollapsed, | ||
activeGroup, | ||
setActiveGroup, | ||
}), | ||
[secondaryNavEl, isMobile, isCollapsed, setIsCollapsed, activeGroup] | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is useMemo here doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always wrap context values in useMemo to prevent every consumer of the context from rerendering if this component does. Though since the context is near the top of the render tree it probably doesn't matter much
- Adds the secondary nav menu to the mobile menu when you first tap the hamburger menu - In order to display the header title, adds `activeGroup` state to the navigation context (also need to add a prop to `<SecondaryNavigation />` and update callsites - Adds `layout` to the nav context so components can render differently based on the current layout (mobile or sidebar)
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Ref #84018
activeGroup
state to the navigation context (also need to add a prop to<SecondaryNavigation />
and update callsiteslayout
to the nav context so components can render differently based on the current layout (mobile or sidebar)Before:
After:
CleanShot.2025-02-04.at.15.56.50.mp4