-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# v2.5.0 Upgrade Guide | ||
|
||
## `getChildRoutes`, `getIndexRoute` signature | ||
|
||
**This is unlikely to affect you, even if you use `getChildRoutes` and `getIndexRoute`.** | ||
|
||
The signature of `getChildRoutes` and `getIndexRoute` has been changed from `(location: Location, callback: Function) => any` to `(partialNextState: RouterState, callback: Function) => any`. That means that instead of writing | ||
|
||
```js | ||
getChildRoutes(location, cb) { | ||
cb(fetchRoutes(location.query)) | ||
} | ||
``` | ||
|
||
You would instead need to write | ||
|
||
```js | ||
getChildRoutes(partialNextState, cb) { | ||
cb(fetchRoutes(partialNextState.location.query)) | ||
} | ||
``` | ||
|
||
However, you now also have access to the partial matched `params` up to that point on `partialNextState`, and can use those to determine which routes to return. | ||
|
||
You will still be able to access location properties directly on `partialNextState` until the next breaking release (and in fact they will shadow router state properties, if applicable), but this will cause a deprecation warning in development mode. |