]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
Section about deprecated onDemand and onAbort callback arguments (#2330)
authorSteve König <steve.koenig@outlook.com>
Tue, 6 Aug 2024 06:28:36 +0000 (08:28 +0200)
committerGitHub <noreply@github.com>
Tue, 6 Aug 2024 06:28:36 +0000 (08:28 +0200)
* Added deprecated onDemand and onAbort callback arguments to migration guide

The  onDemand and onAbort  callbacks for router.push and .replace were deprecated in v4. I added a section to the migration guide explaining that users should replace them with the thenable Promise the methods return.

* Apply suggestions from code review

* Update packages/docs/guide/migration/index.md [skip ci]

---------

Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com>
packages/docs/guide/migration/index.md

index 1f841c89efbc9f1a19a7aeb6c65428f27b01636f..6fb85383b712f0248a1a5a805a9ff73426d206e0 100644 (file)
@@ -443,6 +443,12 @@ Given any [normalized route location](/api/#RouteLocationNormalized):
 
 **Reason**: This allows to easily copy existing properties of a location when calling `router.push()` and `router.resolve()`, and make the resulting route location consistent across browsers. `router.push()` is now idempotent, meaning that calling `router.push(route.fullPath)`, `router.push({ hash: route.hash })`, `router.push({ query: route.query })`, and `router.push({ params: route.params })` will not create extra encoding.
 
+### `$router.push()` and `$router.replace()` - `onComplete` and `onAbort` callbacks
+
+Previously, `$router.push()` and `$router.replace()` accepted two callbacks, `onComplete` and `onAbort`, as second and third arguments. They were called after a navigation based on the result. With the introduction of a Promise based API, these callbacks are redundant and have been removed. See [Navigation Failures](/guide/advanced/navigation-failures.md) for more information on how to detect successful and failed navigations.
+
+**Reason**: Reduce library size by adapting to established JS standards (Promises).
+
 ### TypeScript changes
 
 To make typings more consistent and expressive, some types have been renamed: