Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 1016 Bytes

v2.5.0.md

File metadata and controls

25 lines (17 loc) · 1016 Bytes

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

getChildRoutes(location, cb) {
  cb(fetchRoutes(location.query))
}

You would instead need to write

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.