Which project does this relate to?
Router
Describe the bug
Throwing a redirect in root route beforeLoad with pendingComponent and pendingMs: 0 fail into 'Tried to render a redirected route match! This is a weird circumstance, please file an issue!'
Your Example Website or App
https://stackblitz.com/edit/tanstack-router-gvh2rqij?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue
Open the stackblitz example. It should redirect to /posts and not showing a white page with an js error.
const rootRoute = createRootRoute({
component: RootComponent,
pendingMs: 0,
pendingComponent: () => <div>loading</div>,
beforeLoad: async () => {
await new Promise((resolve) => setTimeout(resolve, 1000));
const alreadyRedirected = sessionStorage.getItem(key) === 'true';
sessionStorage.setItem(key, 'true');
if (!alreadyRedirected) {
throw redirect({ to: '/posts' });
}
},
notFoundComponent: () => {
return (
<div>
<p>This is the notFoundComponent configured on root route</p>
<Link to="/">Start Over</Link>
</div>
);
},
});
Expected behavior
Redirect works as expected in root route beforeLoad with pendingComponent and pendingMs: 0
Screenshots or Videos
Platform
- Router Version: 1.168.10
- OS: Linux
- Browser: Chrome
- Browser Version: 146.0.7680.178
- Bundler: vite
- Bundler Version: 8.0.0
Additional context
No response
Which project does this relate to?
Router
Describe the bug
Throwing a
redirectin root route beforeLoad withpendingComponentandpendingMs: 0fail into 'Tried to render a redirected route match! This is a weird circumstance, please file an issue!'Your Example Website or App
https://stackblitz.com/edit/tanstack-router-gvh2rqij?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue
Open the stackblitz example. It should redirect to /posts and not showing a white page with an js error.
Expected behavior
Redirect works as expected in root route beforeLoad with
pendingComponentandpendingMs: 0Screenshots or Videos
Platform
Additional context
No response