You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: active-rfcs/0000-router-navigation-failures.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
# Summary
7
7
8
-
-Explicitely define what a navigation failure is and how and where we can catch them.
8
+
-Explicitly define what a navigation failure is, and how and where we can catch them.
9
9
- Change when the Promised-based `router.push`(and `router.replace` by extension) resolves and rejects.
10
10
- Make `router.push` consistent with `router.afterEach` and `router.onError`.
11
11
@@ -59,7 +59,7 @@ The current behavior of Vue Router regarding the promise returned by `push` is i
59
59
60
60
-`onError` is only triggered on thrown errors and `next(new Error())`
61
61
-`afterEach` is only called if there is a navigation
62
-
-`redirect` should behave the same as `next('/url')` in a Navigation guard when it comes to the outcome of `router.push` and calls of `router.afterEach`/`router.onError`. The only differenc being that a `redirect` would only trigger leave guards and other before guards for the redirected location but not the original one
62
+
-`redirect` should behave the same as `next('/url')` in a Navigation guard when it comes to the outcome of `router.push` and calls of `router.afterEach`/`router.onError`. The only difference being that a `redirect` would only trigger leave guards and other before guards for the redirected location but not the original one
63
63
64
64
The differences between the Promise resolution/rejection vs `router.afterEach` and `router.onError` are inconsistent and confusing.
65
65
@@ -74,7 +74,7 @@ One of the main points is to be able to consistently handle failed navigations g
74
74
- Triggers `router.onError`
75
75
- Rejects the `Promise` returned by `router.push`
76
76
77
-
It's important to note there is no overlap in these two groups: if there is an uhandled error in a Navigation Guard, it will trigger `router.onError` as well as rejecting the `Promise` returned by `router.push` but **will not trigger**`router.afterEach`. Cancelling a navigation with `next(false)` will not trigger `router.onError` but will trigger `router.afterEach`
77
+
It's important to note there is no overlap in these two groups: if there is an unhandled error in a Navigation Guard, it will trigger `router.onError` as well as rejecting the `Promise` returned by `router.push` but **will not trigger**`router.afterEach`. Cancelling a navigation with `next(false)` will not trigger `router.onError` but will trigger `router.afterEach`
78
78
79
79
## Changes to the Promise resolution and rejection
0 commit comments