From: Eduardo San Martin Morote Date: Tue, 20 Sep 2022 12:09:00 +0000 (+0200) Subject: docs: redirect records note X-Git-Tag: v4.1.6~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83b63f7;p=thirdparty%2Fvuejs%2Frouter.git docs: redirect records note --- diff --git a/packages/docs/guide/migration/index.md b/packages/docs/guide/migration/index.md index 496550f0..6553e484 100644 --- a/packages/docs/guide/migration/index.md +++ b/packages/docs/guide/migration/index.md @@ -223,6 +223,15 @@ router.currentRoute.value.matched.flatMap(record => **Reason**: This method was only used during SSR and is a one liner that can be done by the user. +### Redirect records cannot use special paths + +Previously, a non documented feature allowed to set a redirect record to a special path like `/events/:id` and it would reuse an existing param `id`. This is no longer possible and there are two options: + +- Using the name of the route without the param: `redirect: { name: 'events' }`. Note this won't work if the param `:id` is optional +- Using a function to recreate the new location based on the target: `redirect: to => ({ name: 'events', params: to.params })` + +**Reason**: This syntax was rarely used and _another way of doing things_ that wasn't shorter enough compared to the versions above while introducing some complexity and making the router heavier. + ### **All** navigations are now always asynchronous All navigations, including the first one, are now asynchronous, meaning that, if you use a `transition`, you may need to wait for the router to be _ready_ before mounting the app: