Which project does this relate to?
Router
Describe the bug
Let say I have a protected route createFileRoute("/(app)/_authed") where I will throw an error
e.g. if (!authSession) { throw new Error("Unauthorized", { cause: 401 }); }
Right now this is working only client-side. The error message and cause is caught and displayed by the defaultErrorComponent.
However if i do a full page refresh and fetch from the server with SSR I get a brief flash of the "401 Unauthorised" but then it seems like after the page hydrates, it then shows "Undefined Unauthorised" as the cause from the error is gone.
Im suspecting this might be related to the GET http://localhost:3000/my-todos 500 (Internal Server Error) call.
Your Example Website or App
https://github.com/Zefty/tanstack-playground
Steps to Reproduce the Bug or Issue
- Clone https://github.com/Zefty/tanstack-playground
- Run
pnpm dev
- Navigate to
http://localhost:3000/my-todos which should be an authed route. This should show "401 Unauthorised"
- Click refresh button of browser. This should show "undefined Unauthorized" which is wrong as there as a flash of "401 Unauthorised"
Expected behavior
Both client-side navigation and ssr should show the same page
"401 Unauthorised"
Screenshots or Videos
No response
Platform
- Router / Start Version: [e.g. 1.121.0]
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Browser Version: [e.g. 91.1]
- Bundler: [e.g. vite]
- Bundler Version: [e.g. 7.0.0]
Additional context
No response
Which project does this relate to?
Router
Describe the bug
Let say I have a protected route
createFileRoute("/(app)/_authed")where I will throw an errore.g.
if (!authSession) { throw new Error("Unauthorized", { cause: 401 }); }Right now this is working only client-side. The error message and cause is caught and displayed by the
defaultErrorComponent.However if i do a full page refresh and fetch from the server with SSR I get a brief flash of the "401 Unauthorised" but then it seems like after the page hydrates, it then shows "Undefined Unauthorised" as the cause from the error is gone.
Im suspecting this might be related to the
GET http://localhost:3000/my-todos 500 (Internal Server Error)call.Your Example Website or App
https://github.com/Zefty/tanstack-playground
Steps to Reproduce the Bug or Issue
pnpm devhttp://localhost:3000/my-todoswhich should be an authed route. This should show "401 Unauthorised"Expected behavior
Both client-side navigation and ssr should show the same page
"401 Unauthorised"
Screenshots or Videos
No response
Platform
Additional context
No response