@@ -245,17 +245,11 @@ var Routes = React.createClass({
245
245
'inside some other component\'s render method'
246
246
) ;
247
247
248
- if ( this . _handleStateChange ) {
249
- this . _handleStateChange ( ) ;
250
- delete this . _handleStateChange ;
251
- }
248
+ this . _handleStateChange ( ) ;
252
249
} ,
253
250
254
251
componentDidUpdate : function ( ) {
255
- if ( this . _handleStateChange ) {
256
- this . _handleStateChange ( ) ;
257
- delete this . _handleStateChange ;
258
- }
252
+ this . _handleStateChange ( ) ;
259
253
} ,
260
254
261
255
/**
@@ -295,19 +289,25 @@ var Routes = React.createClass({
295
289
} else if ( abortReason ) {
296
290
this . goBack ( ) ;
297
291
} else {
298
- this . _handleStateChange = this . handleStateChange . bind ( this , path , actionType , this . state . matches ) ;
292
+ this . _nextStateChangeHandler = this . _finishTransitionTo . bind ( this , path , actionType , this . state . matches ) ;
299
293
this . setState ( nextState ) ;
300
294
}
301
295
} ) ;
302
296
} ,
303
297
304
- handleStateChange : function ( path , actionType , previousMatches ) {
298
+ _handleStateChange : function ( ) {
299
+ if ( this . _nextStateChangeHandler ) {
300
+ this . _nextStateChangeHandler ( ) ;
301
+ delete this . _nextStateChangeHandler ;
302
+ }
303
+ } ,
304
+
305
+ _finishTransitionTo : function ( path , actionType , previousMatches ) {
305
306
var currentMatches = this . state . matches ;
306
307
updateMatchComponents ( currentMatches , this . refs ) ;
307
308
308
- if ( shouldUpdateScroll ( currentMatches , previousMatches ) ) {
309
+ if ( shouldUpdateScroll ( currentMatches , previousMatches ) )
309
310
this . updateScroll ( path , actionType ) ;
310
- }
311
311
312
312
if ( this . props . onChange )
313
313
this . props . onChange . call ( this ) ;
0 commit comments