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

Navigation guard redirect causes errors when navigating programmatically #3224

Closed
the-owl opened this issue Jun 11, 2020 · 1 comment
Closed

Comments

@the-owl
Copy link

the-owl commented Jun 11, 2020

Version

3.3.2

Reproduction link

https://codesandbox.io/s/vue-router-zb7l4

Steps to reproduce

Click on Navigate button. It will trigger navigation via router.push which will cause an error.

What is expected?

User gets silently redirected to location that was passed to next(...) in navigation guard.

What is actually happening?

Call to router.push throws an error, but the redirect still happens.


In my app, users that have not completed initial setup process after signup should be redirected to setup page. There is a navigation guard for this: if user has not completed setup, do a redirect. When user logs in, app redirects him to home page via router.push(). And when user has not finished setup process, this will cause an error.

This behavior seems to be introduced in 3.3.0 by this commit 4c727f9

I don't know whether this is a bug or intentional behavior. If it's intentional, why was it introduced? For me it seems counter-intuitive that a simple redirect causes an error.

@posva
Copy link
Member

posva commented Jun 11, 2020

The Promise rejection was already there, we now have an error to give information about the rejection. Note in the codesandbox the error overlay is part of the development experience, not an actual error crashing the application.

For more info about where does this comes from see #3047 and vuejs/rfcs#150

I opened #3225 which is related to this but different

@posva posva closed this as completed Jun 11, 2020
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