Description
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.