Skip to content

Commit 95c6d8f

Browse files
posvabencodezen
andauthored
Apply suggestions from code review
Co-authored-by: Ben Hong <[email protected]>
1 parent a450471 commit 95c6d8f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/guide/advanced/navigation-failures.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
> New in 3.4.0
44
5-
When using `router-link`, Vue Router internally calls `router.push` to trigger a navigation. Depending on the current location and existing [Navigation Guards](./navigation-guards.md), this navigation might end up in a new page being shown, but there are a couple of situations where we will stay on the same page:
5+
When using `router-link`, Vue Router calls `router.push` to trigger a navigation. While the expected behavior for most links is to navigate a user to a new page, there are a few situations where users will remain on the same page:
66

77
- We are already on the page we are trying to go to
8-
- A navigation guard aborts the navigation by calling `next(false)`
9-
- A navigation guard throws an error or calls `next(new Error())`
8+
- A [navigation guard](./navigation-guards.md) aborts the navigation by calling `next(false)`
9+
- A [navigation guard](./navigation-guards.md) throws an error or calls `next(new Error())`
1010

1111
When using a regular `router-link`, **none of these failures will log an error**. However, if you are using `router.push` or `router.replace`, you might come across an _"Uncaught (in promise) Error"_ message followed by a more specific message in your console. Let's understand how to differentiate _Navigation Failures_.
1212

1313
::: tip Background story
14-
_Navigation Failures_ were exposed on version 3.2.0 but existed for a long time before: through the two optional callbacks of `router.push`, `onComplete` and `onAbort` that can be passed to `router.push`. Since version 3.1.0, `router.push` and `router.replace` return a _Promise_ if no `onComplete`/`onAbort` callback is provided. This _Promise_ resolves instead of invoking `onComplete` and rejects instead of invoking `onAbort`.
14+
In v3.2.0, _Navigation Failures_ were exposed through the two optional callbacks of `router.push`: `onComplete` and `onAbort`. Since version 3.1.0, `router.push` and `router.replace` return a _Promise_ if no `onComplete`/`onAbort` callback is provided. This _Promise_ resolves instead of invoking `onComplete` and rejects instead of invoking `onAbort`.
1515
:::
1616

1717
## Detecting Navigation Failures
@@ -36,7 +36,7 @@ If you omit the second parameter: `isNavigationFailure(failure)`, it will only c
3636

3737
## `NavigationFailureType`
3838

39-
`NavigationFailureType` exposes the following properties to differentiate _Navigation Failures_:
39+
`NavigationFailureType` help developers to differentiate between the various types of _Navigation Failures_. There are four different types:
4040

4141
- `redirected`: `next(newLocation)` was called inside of a navigation guard to redirect somewhere else.
4242
- `aborted`: `next(false)` was called inside of a navigation guard to the navigation.
@@ -57,4 +57,4 @@ router.push('/admin').catch(failure => {
5757
})
5858
```
5959

60-
In all cases, `from` and `to` are normalized route locations.
60+
In all cases, `to` and `from` are normalized route locations.

0 commit comments

Comments
 (0)