Which project does this relate to?
Router
Describe the bug
Throwing a non-Error value from route’s beforeLoad during SSR does not render the configured error component. Instead, it returns an empty 200 HTML response.
Complete minimal reproducer
https://github.com/alex35mil/tanstack-beforeLoad-throw
Steps to Reproduce the Bug
- Start the server
- Go to the main page
- Should see 200 with empty body
Expected behavior
Error page should be rendered.
Screenshots or Videos
No response
Platform
"@tanstack/react-router": "1.168.10",
"@tanstack/react-start": "1.167.16",
- OS: macOS
- Browser: Arc
- Browser Version: 1.146.0
- Bundler: vite
- Bundler Version:
Additional context
I work with ReScript and for expected errors, I throw error variant, so I could match against it in the error component. Variant is represented as JS string at runtime, and throwing string results in the described issue.
Simplified demonstration:
// Error.res
type t = [>
| #Maintenance
| #Internal
]
// Route.res
let beforeLoad = async _ => {
// At runtime #Maintenance is a JS string
#Maintenance->throw
}
// ErrorComponent.res
@react.component
let make = (~error: Error.t) => {
switch error {
| #Maintenance => <p> {"Maintenance"->React.string} </p>
| #Internal
| _ => <p> {"Internal error"->React.string} </p>
}
}
Which project does this relate to?
Router
Describe the bug
Throwing a non-
Errorvalue from route’sbeforeLoadduring SSR does not render the configured error component. Instead, it returns an empty200HTML response.Complete minimal reproducer
https://github.com/alex35mil/tanstack-beforeLoad-throw
Steps to Reproduce the Bug
Expected behavior
Error page should be rendered.
Screenshots or Videos
No response
Platform
Additional context
I work with ReScript and for expected errors, I throw error variant, so I could match against it in the error component. Variant is represented as JS string at runtime, and throwing string results in the described issue.
Simplified demonstration: