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

onError not called on next false #2956

Closed
afwn90cj93201nixr2e1re opened this issue Oct 7, 2019 · 2 comments
Closed

onError not called on next false #2956

afwn90cj93201nixr2e1re opened this issue Oct 7, 2019 · 2 comments

Comments

@afwn90cj93201nixr2e1re
Copy link

https://github.com/vuejs/vue-router/blob/dev/src/history/base.js#L107
not called on return false, should be called, or add global onAbort hook.
Also npm src, doesn't contain subdirs, there only 4-5 files in root src, nothing else.

@posva

@posva
Copy link
Member

posva commented Oct 7, 2019

Don't hijack the issue helper. A repro is required
The file issue has been fixed and will appear in the next release

@posva posva closed this as completed Oct 7, 2019
@afwn90cj93201nixr2e1re
Copy link
Author

As i said, just check the code, you missed onError callback calling here: https://github.com/vuejs/vue-router/blob/dev/src/history/base.js#L107 , but checking for false here: https://github.com/vuejs/vue-router/blob/dev/src/history/base.js#L153

simple code:
beforeRouteEnter(to, from, next){
if(1){next(new Error('This gonna call onError global route Hook');return;}
if(1){next(false);return;}//but that's not, this call only onAbort local route link.
}

i know, thats expected coz that's onError which mean calback should be called only on Error, but how we should operate/hook on false next on global level, which also stop routing?

I think you should add ||error===false
or create new global hook for router which called onCancel.

You really need repo gor this?

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