You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an error is thrown from beforeLoad and handled througherrorComponent it only works as expected on client navigation. When the page is reloaded/first requested the return for errorComponent is ignored and component/rest of the tree is rendered. This breaks many auth setups currently.
This can be reproduced using the Start Basic Auth example.
Navigate to "Posts" – the login is shown ✅
Now reload the "Posts" page – error is shown instead of login ❌
This error is shown:
posts is not iterable
You can also add a console.log to app/routes/_authed/posts.tsx. This shows it tries to render the component, even though we are still unauthenticated and beforeLoad in app/routes/_authed.tsx throws an error which is handled by errorComponent, which should prevent rendering of the posts/component.
Expected behavior
When throwing an error from beforeLoad and handling it within errorComponent the component should not be rendered – even on intial request handled by the server without client side navigation.
Screenshots or Videos
start-before-load-error-component.mp4
Platform
OS: macOS
Browser: Chromium
Version: 133
Additional context
No response
The text was updated successfully, but these errors were encountered:
Which project does this relate to?
Start
Describe the bug
When an error is thrown from
beforeLoad
and handled througherrorComponent
it only works as expected on client navigation. When the page is reloaded/first requested the return forerrorComponent
is ignored andcomponent
/rest of the tree is rendered. This breaks many auth setups currently.Your Example Website or App
https://tanstack.com/start/latest/docs/framework/react/examples/start-basic-auth
Steps to Reproduce the Bug or Issue
This can be reproduced using the Start Basic Auth example.
This error is shown:
You can also add a
console.log
toapp/routes/_authed/posts.tsx
. This shows it tries to render the component, even though we are still unauthenticated andbeforeLoad
inapp/routes/_authed.tsx
throws an error which is handled byerrorComponent
, which should prevent rendering of the posts/component
.Expected behavior
When throwing an error from
beforeLoad
and handling it withinerrorComponent
thecomponent
should not be rendered – even on intial request handled by the server without client side navigation.Screenshots or Videos
start-before-load-error-component.mp4
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: