-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
New Promise API seems to break next(false)
implementation in guard
#2873
Comments
This is actually intended, before the error was not visible unless a callback was passed to this.$router.replace({ name: 'foo' }).catch(err => {
console.log('all good')
}) A more detailed explanation: #2881 (comment) |
So a navigation abort is an error? |
It's built as an Error but it doesn't necessarily mean it's an error in your app, although it could be in some situations.
|
I understand it and you are right, the error is not catching the promise rejection. But if this is a "major" API change (because is not backwards compatible with previous implementation) it not should be, as semversion states, 4.0.0 instead of 3.1.*? |
it's not a major api change. It is even backwards compatible, we can still use callbacks but now when no callbacks are provided, the navigation abortion is visible unless the promise is caught |
It is a breaking change if somebody has to change code to implement the new library and maintain the same behavior. |
Is there a way to catch this rejection when navigating using Or do I need to have a link call a method that calls |
The hyperlinks generated with |
It shouldn'tbut if you can reproduce it on a boiled down example, please eopen an new issue
Eduardo San Martin Morote
… On 13 Aug 2019, at 03:52, Kumar Gaurav ***@***.***> wrote:
The hyperlinks generated with <router-link> is not clickable on mac os on any browser but works perfect on widows. Can this issue be a reason for that ?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
|
this is also breaking jest route guard tests. cant there be a global handler for the promise rejection ? |
I don't know if it is a good idea, but just
|
@sstenn no, always call next exactly one time in guards |
Version
3.1.1
Reproduction link
https://jsfiddle.net/ox6qpz9t/1/
Steps to reproduce
foo
button that will navigate programmatically tofoo
route (with replace method) that has abeforeEnter
guard.Uncaught (in promise) false
will appear when navigation is being aborted in guard withnext(false)
What is expected?
Abort navigation without error
What is actually happening?
Aborted navigation with unhandled promise error in console.
In version 3.0.7, with the old API (not the new one that returns a promise) was working fine.
The text was updated successfully, but these errors were encountered: