@@ -5,17 +5,27 @@ import { createRoutes } from './RouteUtils'
5
5
import { canUseMembrane } from './deprecateObjectProperties'
6
6
import deprecateLocationProperties from './deprecateLocationProperties'
7
7
8
- function getChildRoutes ( route , progressState , callback ) {
8
+ function getChildRoutes ( route , location , paramNames , paramValues , remainingPathname , callback ) {
9
9
if ( route . childRoutes ) {
10
10
return [ null , route . childRoutes ]
11
11
}
12
12
if ( ! route . getChildRoutes ) {
13
13
return [ ]
14
14
}
15
15
16
- let sync = true , result
16
+ let sync = true , result , progressStateWithLocation
17
+ const progressState = {
18
+ params : createParams ( paramNames , paramValues ) ,
19
+ remainingPathname
20
+ }
21
+
22
+ if ( __DEV__ && canUseMembrane ) {
23
+ progressStateWithLocation = deprecateLocationProperties ( progressState , location )
24
+ } else {
25
+ progressStateWithLocation = { ...progressState , ...location }
26
+ }
17
27
18
- route . getChildRoutes ( progressState , function ( error , childRoutes ) {
28
+ route . getChildRoutes ( progressStateWithLocation , function ( error , childRoutes ) {
19
29
childRoutes = ! error && createRoutes ( childRoutes )
20
30
if ( sync ) {
21
31
result = [ error , childRoutes ]
@@ -162,19 +172,7 @@ function matchRouteDeep(
162
172
}
163
173
}
164
174
165
- const progressState = {
166
- params : createParams ( paramNames , paramValues ) ,
167
- remainingPathname
168
- }
169
- let progressStateWithLocation
170
-
171
- if ( __DEV__ && canUseMembrane ) {
172
- progressStateWithLocation = deprecateLocationProperties ( progressState , location )
173
- } else {
174
- progressStateWithLocation = { ...progressState , ...location }
175
- }
176
-
177
- const result = getChildRoutes ( route , progressStateWithLocation , onChildRoutes )
175
+ const result = getChildRoutes ( route , location , paramNames , paramValues , remainingPathname , onChildRoutes )
178
176
if ( result ) {
179
177
onChildRoutes ( ...result )
180
178
}
0 commit comments