router
router copied to clipboard
Throwing a redirect in `beforeLoad` from __root.tsx causes a suspense error
Describe the bug
If I try to redirect a user in beforeLoad in my __root.tsx file then I get A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition. upon visiting a URL that redirects me initially.
Your Example Website or App
https://stackblitz.com/edit/tanstack-router-uc7am2?file=src%2Froutes%2F__root.tsx
Steps to Reproduce the Bug or Issue
- Go to repro
- Open
/custom/redirectin your browser
Expected behavior
It to not error.
Screenshots or Videos
No response
Platform
- OS: [e.g. macOS, Windows, Linux] Linux
- Browser: [e.g. Chrome, Safari, Firefox] Chrome & Firefox
- Version: [e.g. 91.1] FF 122.0, Chrome 121.0.6167.85
Additional context
No response