Problem
When navigating between pages that use different layouts (e.g. layouts/app → layouts/coach), the SPA router does a fragment swap of the <main> content but keeps the old layout's nav, sidebar, and other layout-level elements. The user sees the new page content but with the wrong navigation.
Reproduction
- Page A extends
layouts/app(includesnav.stxwith athlete routes) - Page B extends
layouts/coach(includescoach-nav.stxwith coach routes +coach-sidebar.stx) - Navigate from Page A to Page B via
<StxLink to="/coaches"> - Expected: Full layout swap — coach nav, coach sidebar, coach content
- Actual: Only the
<main>content swaps. The athlete nav stays, coach sidebar never appears
Root Cause
The router's layout check ([router] layout check: current=layouts/coach(app) new=layouts/coach(app)) appears to match layouts incorrectly, treating different layouts as the same. When layouts differ, the router should do a full page reload (or full DOM swap) instead of a fragment-only swap.
Current Workaround
Using plain <a href> instead of <StxLink> for cross-layout navigation forces a full page load, which correctly loads the new layout. This works but defeats SPA navigation benefits.
Expected Behavior
When <StxLink> navigates to a page with a different @extends('layouts/...'), the router should:
- Detect the layout mismatch
- Either do a full page reload OR swap the entire document shell (nav + sidebar + main), not just the
<main>fragment
Environment
- stx version: 0.2.10 (local linked)
- Two layouts:
layouts/app(athlete) andlayouts/coach(coach) - Training dashboard app with role-based views
🤖 Generated with Claude Code