Closed
Description
What problem does this feature solve?
On SSR applications there's currently a scenario in which onReady
is called too early and either the wrong route is rendered, or worse a server error is thrown (depending on your SSR code).
Here's the scenario:
- User navigates to route A
- route A has navigation guards that at some point call next('/routeB') to redirect
- onReady fires (
onReady
triggers the onError callback with a redirection #3225), telling the SSR to render route A, the redirect never completes
This comes with multiple issues. I have not tested it, but since route A is rendered on the server and route B is rendered on the client, you might run into hydration issues. More than that, in case route A does not match any component, the SSR might unnecessarily return an error based on how you handle routes with no matched components.
You can circumvent this issue by using the router.push
API, but I guess this is not the intended way to navigate within navigation guards?
What does the proposed API look like?
next({
path: '/routeB',
ignoreRedirectErrors: true
});
Metadata
Metadata
Assignees
Labels
No labels