Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Suppressing (Redirect) Errors in Programmatic Navigation / Navigation Guards #3329

Closed
j0Shi82 opened this issue Sep 24, 2020 · 3 comments

Comments

@j0Shi82
Copy link

j0Shi82 commented Sep 24, 2020

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:

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
});
@posva
Copy link
Member

posva commented Sep 24, 2020

Can you provide a boiled down reproduction (https://ssr.vuejs.org/ should help) so I can check if this is a problem

@posva posva added bug and removed need repro labels Sep 24, 2020
@posva
Copy link
Member

posva commented Sep 24, 2020

Nevermind, it reproduces by adding a test to 4d484bf#diff-c044368ddb9969465784dfa4ebfa75cd with the path of the current route

@posva
Copy link
Member

posva commented Sep 24, 2020

I was actually testing on the wring test and this seems to work on the latest version as the currentRoute is valid inside onReady. It might be related to some other code you have in your application. If you manage to boil it down, please open a new issue with the reproduction so I can take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants