Minimal reproduction for a client-side head/meta issue.
"@tanstack/react-router": "1.170.15",
"@tanstack/react-start": "1.168.25",
"@vitejs/plugin-react": "6.0.2",
"react": "19.2.7",
"react-dom": "19.2.7",Route tree:
__root
_app // parent route with beforeLoad + head + errorComponent
child // child route with headThe parent _app route throws from beforeLoad when ?fail=true.
From router source, when a parent beforeLoad throws:
- descendant
beforeLoads are skipped - descendant loaders are skipped
headMaxIndexis capped to the throwing route- only heads up to the throwing route should execute
So the child route's head should not affect the document after _app.beforeLoad throws.
pnpm install
pnpm devOpen:
http://127.0.0.1:3000/child?fail=falseThe document title should be:
Child success titleThen client-navigate to:
http://127.0.0.1:3000/child?fail=trueusing the link on the page.
The parent _app error component renders, and the document title should be from _app.head:
App error titleThe child route head should not execute or influence the document head after the parent beforeLoad error.
On client navigation, the parent error component renders, but stale child meta/title can remain from the previous successful child match:
Child success titleThis happens even though the child head is not supposed to participate after the parent beforeLoad error.
tss/routes/_app/route.tsx
tss/routes/_app/child/route.tsx