@@ -329,17 +329,18 @@ function runTransitionHooks(routes, transition) {
329
329
toMatches = nextMatches ;
330
330
}
331
331
332
+ var query = Path . extractQuery ( transition . path ) || { } ;
333
+
332
334
return runTransitionFromHooks ( fromMatches , transition ) . then ( function ( ) {
333
335
if ( transition . isAborted )
334
336
return ; // No need to continue.
335
337
336
- return runTransitionToHooks ( toMatches , transition ) . then ( function ( ) {
338
+ return runTransitionToHooks ( toMatches , transition , query ) . then ( function ( ) {
337
339
if ( transition . isAborted )
338
340
return ; // No need to continue.
339
341
340
342
var rootMatch = getRootMatch ( nextMatches ) ;
341
343
var params = ( rootMatch && rootMatch . params ) || { } ;
342
- var query = Path . extractQuery ( transition . path ) || { } ;
343
344
344
345
return {
345
346
path : transition . path ,
@@ -380,15 +381,15 @@ function runTransitionFromHooks(matches, transition) {
380
381
* with the transition object and any params that apply to that handler. Returns
381
382
* a promise that resolves after the last handler.
382
383
*/
383
- function runTransitionToHooks ( matches , transition ) {
384
+ function runTransitionToHooks ( matches , transition , query ) {
384
385
var promise = Promise . resolve ( ) ;
385
386
386
387
matches . forEach ( function ( match ) {
387
388
promise = promise . then ( function ( ) {
388
389
var handler = match . route . props . handler ;
389
390
390
391
if ( ! transition . isAborted && handler . willTransitionTo )
391
- return handler . willTransitionTo ( transition , match . params ) ;
392
+ return handler . willTransitionTo ( transition , match . params , query ) ;
392
393
} ) ;
393
394
} ) ;
394
395
0 commit comments