Skip to content

fix: mobile horizontal sub-nav never rendering in AppNavBar - #5411

Open
zigzagdev wants to merge 2 commits into
uber:mainfrom
zigzagdev:fix/app-nav-bar-mobile-subnav-order
Open

fix: mobile horizontal sub-nav never rendering in AppNavBar#5411
zigzagdev wants to merge 2 commits into
uber:mainfrom
zigzagdev:fix/app-nav-bar-mobile-subnav-order

Conversation

@zigzagdev

Copy link
Copy Markdown
Contributor

Fixes #1, Fixes #2

Description

Fixing an evaluation-order bug in AppNavBar where secondaryMenu, desktopSubNavPosition, and mobileSubNavPosition were plain let variables mutated as a side effect inside the desktop mainItems.map().
Because the mobile nav block is evaluated earlier in the same JSX return statement, it always read these variables before that map ran, so mobileSubNavPosition === POSITION.horizontal could never be true and the mobile horizontal sub-nav never rendered (a // @ts-expect-error always false comment in the source acknowledged this).
Now the active item's secondary menu and positioning are resolved up front via useMemo/find, so both the mobile and desktop blocks read the same, already-resolved values.

Scope

  • Patch: Bug Fix

…ng it

secondaryMenu/desktopSubNavPosition/mobileSubNavPosition were plain
lets mutated as a side effect of the desktop mainItems.map(), which
runs after the mobile block's JSX (evaluated earlier in the same
return statement) already read those variables. The mobile horizontal
sub-nav condition therefore always saw them at their initial values
and could never render, which is what the "always false" ts-expect-error
on that line was masking. Compute the active item's secondary menu and
positioning up front with useMemo/find so both the mobile and desktop
blocks read the same, already-resolved values.
Regression test for the active-item eval-order bug: an item whose
navPosition.mobile is 'horizontal' (and desktop is 'vertical') must
render exactly one "Secondary navigation" nav, on the mobile side.
@zigzagdev zigzagdev changed the title Fix/app nav bar mobile subnav order fix: mobile horizontal sub-nav never rendering in AppNavBar Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant