Skip to content

feat(public): one signed-out header for every public page, with a Dashboard link once a session hydrates - #781

Merged
thinkclay merged 1 commit into
mainfrom
feat/762-public-header
Sep 17, 2026
Merged

thinkclay merged 1 commit into
mainfrom
feat/762-public-header

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

What

Every public route now gets the site header from app/(public)/_layout.tsx instead of four pages mounting it themselves and the other seven having no navigation at all. Fixes #762.

  • MarketingNav gains a Jobs link (the public surface that exists), and an account area that is session-aware: Sign in / Get started for a visitor, a Dashboard link for someone already signed in. Both the desktop row and the mobile menu.
  • Hydration-safe by construction. The account area renders signed-out on the server and on the first client render, even when a session is already in localStorage, and only then switches. New useHydrated() hook (useSyncExternalStore with a false server snapshot) is the gate. Branching on the session directly is the SSR: server and client disagree on React tree position in the app shell (the cause under #625) #679/SSR: authenticated pages intermittently fail hydration and regenerate the tree — the session load races the first client render #681 failure mode — when the session lands before the first client render, the trees differ in structure and React regenerates the tree. A signed-in user therefore sees Sign in for one frame before it becomes Dashboard; the alternative hides the sign-in CTA from every anonymous visitor for the length of hydration, and anonymous visitors are who this header is for.
  • (public)/_layout.tsx renders the header on web and stays a bare <Slot /> on native. sectionBasePath="/" so the landing-section links go home — with the default they were bare #fragments that pointed nowhere on /terms etc.
  • users/_layout.tsx hides its expo-router logo header on web; the site header replaces it. Native unchanged.
  • terms, contact, support, privacy drop their per-page <MarketingNav /> so nothing double-renders.

Verification

  • 4 new tests in packages/scf-core/features/marketing/__tests__/MarketingNav.test.tsx: links, signed-out chrome, Dashboard once hydrated + authenticated, and signed-out chrome when authenticated but not yet hydrated (the server-parity case). Typecheck green for scf-core and scaffald-app; lint clean.

  • Dev server, anonymous, 1440 wide: header on /jobs, /jobs/<slug>, /terms, /users/<slug>; no hydration errors on the listing or the legal pages.

  • Mobile (375): hamburger opens Jobs / How it works / Benefits / FAQs / Sign in / Get started.

  • Signed in as the seeded [email protected] (Playwright, the same login path ui-sweep.mjs uses), 1440 wide:

    page this branch main
    /jobs Jobs · Dashboard no header
    /terms Jobs · Dashboard Sign in · Get started (wrong for a signed-in user)
    /users/eric Jobs · Dashboard, one hydration error no header, the same hydration error

    The /users/<slug> hydration failure while signed in reproduces byte-for-byte on main with this PR's files swapped out, so it is the pre-existing SSR: authenticated pages intermittently fail hydration and regenerate the tree — the session load races the first client render #681 race (the profile page branches on the session), not this change. Noted rather than fixed here; it is on the v1.18.0 deferred list.

Not in this PR

  • Public pages narrower than 1280px still hydrate against useResponsive's fixed 1280 server snapshot, so any responsive branch — this header's, DashboardLayout's, the breadcrumb's — mismatches at tablet widths. Same class as above; unchanged by this PR and shared with the landing page, which has rendered this exact component since July.

🤖 Generated with Claude Code

…hboard link once a session hydrates

Fixes #762.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
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.

Public pages have no navigation, because the only drawer assumes a signed-in user

1 participant