Hosted onseed.hyper.mediavia theHypermedia Protocol

Root cause

  • frontend/packages/ui/src/resource-page-common.tsx: header shows directoryItems when homeNavigationItemsis empty.

  • frontend/apps/desktop/src/components/edit-nav-header-pane.tsx: popover seeds docNav only from homeDocument.detachedBlocks.navigation.

  • So sites using header fallback (no explicit navigation detached block) render nav links in header, but editor menu sees [] and shows only “Add Navigation Item”.

Plan

  1. frontend/apps/desktop/src/components/edit-nav-header-pane.tsx

    • import useDirectorygetSiteNavDirectorypackHmIdnanoiduseMemouseRef.

    • keep current explicit-nav extraction as-is.

    • add directory query for homeId.

    • build fallbackNav: HMNavigationItem[] from getSiteNavDirectory({id: homeId, directory}).

      • textitem.metadata.name || ''

      • linkitem.id ? packHmId(item.id) : item.webUrl || ''

      • type: 'Link'

      • id: stable synthetic block id per item key via useRef(new Map()); generate once with nanoid(). Important so drag/reorder/edit state stays stable across renders.

    • choose source:

      • machineNavigation first

      • else explicit publishedNav if non-empty

      • else fallbackNav

    • pass that into EditNavPopover.

  2. Tests: add frontend/apps/desktop/src/components/__tests__/edit-nav-header-pane.test.tsx

    • mock EditNavPopover; assert received docNav.

    • cases:

      • no explicit nav + directory items => popover gets fallback items.

      • explicit nav exists => explicit nav wins over directory fallback.

      • machine draft nav exists => machine nav wins over both.

  3. Optional small cleanup

    • extract tiny local mapper(s) inside edit-nav-header-pane.tsx for readability only if needed; no new shared module unless duplication grows.

Why this fix

  • minimal; desktop-only.

  • matches what user currently sees in header.

  • preserves existing publish flow: first edit on fallback nav creates explicit navigation block, which is the expected transition from auto-nav to custom-nav.

Unresolved questions

  • Should editor fallback mirror only the public header (getSiteNavDirectory default), or should it include editor-visible private children too? My read: mirror public header exactly.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime