Skip to content

Commit a6251e2

Browse files
posvasnoozbuster
andauthored
Apply suggestions from code review
Co-Authored-By: Alex Van Liew <[email protected]>
1 parent 1cb2b53 commit a6251e2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

active-rfcs/0000-router-navigation-failures.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Summary
77

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.
99
- Change when the Promised-based `router.push`(and `router.replace` by extension) resolves and rejects.
1010
- Make `router.push` consistent with `router.afterEach` and `router.onError`.
1111

@@ -59,7 +59,7 @@ The current behavior of Vue Router regarding the promise returned by `push` is i
5959

6060
- `onError` is only triggered on thrown errors and `next(new Error())`
6161
- `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
6363

6464
The differences between the Promise resolution/rejection vs `router.afterEach` and `router.onError` are inconsistent and confusing.
6565

@@ -74,7 +74,7 @@ One of the main points is to be able to consistently handle failed navigations g
7474
- Triggers `router.onError`
7575
- Rejects the `Promise` returned by `router.push`
7676

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`
7878

7979
## Changes to the Promise resolution and rejection
8080

@@ -170,4 +170,4 @@ router.afterEach((to, from, failure) => {
170170
# Adoption strategy
171171

172172
- `afterEach` and `onError` are relatively simple to migrate, most of the time they are not used many times either.
173-
- `router.push
173+
- `router.push` doesn't reject when navigation fails anymore. Any code relying on catching an error should await the promise result instead.

0 commit comments

Comments
 (0)