Which project does this relate to?
Router
Describe the bug
Scenario
Route tree:
__root
_app // parent route with beforeLoad + head
child // child route with head
The 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
headMaxIndex is 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.
On server, the title is correct. But on client, the document.title is set by the child component.
Complete minimal reproducer
https://github.com/alex35mil/tanstack-stale-child-head-after-beforeLoad-error
Steps to Reproduce the Bug
Open:
http://127.0.0.1:3000/child?fail=false
The document title should be:
Then navigate to:
http://127.0.0.1:3000/child?fail=true
The title should be App error title, but it's Child success title on the client.
Expected behavior
The title should be App error title when parent beforeLoad throws.
Screenshots or Videos
No response
Platform
"@tanstack/react-router": "1.170.15",
"@tanstack/react-start": "1.168.25",
- OS: macOS
- Browser: Arc
- Browser Version: 1.146.0
- Bundler: vite
- Bundler Version:
Additional context
No response
Which project does this relate to?
Router
Describe the bug
Scenario
Route tree:
__root _app // parent route with beforeLoad + head child // child route with headThe parent
_approute throws frombeforeLoadwhen?fail=true.From router source, when a parent
beforeLoadthrows:beforeLoads are skippedheadMaxIndexis capped to the throwing routeSo the child route's head should not affect the document after
_app.beforeLoadthrows.On server, the title is correct. But on client, the
document.titleis set by thechildcomponent.Complete minimal reproducer
https://github.com/alex35mil/tanstack-stale-child-head-after-beforeLoad-error
Steps to Reproduce the Bug
Open:
The document title should be:
Then navigate to:
The title should be
App error title, but it'sChild success titleon the client.Expected behavior
The title should be
App error titlewhen parentbeforeLoadthrows.Screenshots or Videos
No response
Platform
Additional context
No response