Describe the bug#
I think there's a regression on onError, the documentation states:
"If this function returns a redirect object, the redirect will be applied immediately."
https://tanstack.com/router/latest/docs/framework/react/api/router/RouteOptionsType#onerror-property
... But the typings say otherwise:
onError?: (err: any) => void;
Your Example Website or App#
https://tanstack.com/router/latest/docs/framework/react/api/router/RouteOptionsType#onerror-property
Steps to Reproduce the Bug or Issue#
- create a Route.loader()
- throw inside it
- define Route.onError
- return a redirect
Expected behavior#
Are we allowed to return a redirect()?
Screenshots or Videos#
No response
Platform#
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context#
No response
The docs need to be updated here.
The implementation requires that a
redirectbe thrown from theonErrorcallback for it to be consumed by the handled by the router.