modules/components/Routes.js
/**
 * Runs all transition hooks that are required to get from the current state
 * to the state specified by the given transition and updates the current state
 * if they all pass successfully. Returns a promise that resolves to the new
 * state if it needs to be updated, or undefined if not.
 */
Runs all transition hooks that are required to get from the current state
to the state specified by the given transition and updates the current state
if they all pass successfully. Returns a promise that resolves to the new
state if it needs to be updated, or undefined if not.
Runs all transition hooks that are required to get from the current state to the state specified by the given transition and updates the current state if they all pass successfully . Returns a promise that resolves to the new state if it needs to be updated or undefined if not .
function syncWithTransition(routes, transition) {
  if (routes.state.path === transition.path)
    return Promise.resolve(); 
  var currentMatches = routes.state.matches;
  var nextMatches = routes.match(transition.path);
  warning(
    nextMatches,
    'No route matches path "' + transition.path + '". Make sure you have ' +
    '<Route path="' + transition.path + '"> somewhere in your routes'
  );
  if (!nextMatches)
    nextMatches = [];
  var fromMatches, toMatches;
  if (currentMatches) {
    updateMatchComponents(currentMatches, routes.refs);
    fromMatches = currentMatches.filter(function (match) {
      return !hasMatch(nextMatches, match);
    });
    toMatches = nextMatches.filter(function (match) {
      return !hasMatch(currentMatches, match);
    });
  } else {
    fromMatches = [];
    toMatches = nextMatches;
  }
  return checkTransitionFromHooks(fromMatches, transition).then(function () {
    if (transition.isCancelled)
      return; 
    return checkTransitionToHooks(toMatches, transition).then(function () {
      if (transition.isCancelled)
        return; 
      var rootMatch = getRootMatch(nextMatches);
      var params = (rootMatch && rootMatch.params) || {};
      var query = Path.extractQuery(transition.path) || {};
      var state = {
        path: transition.path,
        matches: nextMatches,
        activeParams: params,
        activeQuery: query,
        activeRoutes: nextMatches.map(function (match) {
          return match.route;
        })
      };
      routes.setState(state);
      return state;
    });
  });
}
function syncWithTransition ( routes , transition ) { if ( routes . state . path === transition . path ) return Promise . resolve ( ) ; var currentMatches = routes . state . matches ; var nextMatches = routes . match ( transition . path ) ; warning ( nextMatches , 'No route matches path "' + transition . path + '". Make sure you have ' + '<Route path="' + transition . path + '"> somewhere in your routes' ) ; if ( ! nextMatches ) nextMatches = [ ] ; var fromMatches , toMatches ; if ( currentMatches ) { updateMatchComponents ( currentMatches , routes . refs ) ; fromMatches = currentMatches . filter ( function ( match ) { return ! hasMatch ( nextMatches , match ) ; } ) ; toMatches = nextMatches . filter ( function ( match ) { return ! hasMatch ( currentMatches , match ) ; } ) ; } else { fromMatches = [ ] ; toMatches = nextMatches ; } return checkTransitionFromHooks ( fromMatches , transition ) . then ( function ( ) { if ( transition . isCancelled ) return ; return checkTransitionToHooks ( toMatches , transition ) . then ( function ( ) { if ( transition . isCancelled ) return ; var rootMatch = getRootMatch ( nextMatches ) ; var params = ( rootMatch && rootMatch . params ) || { } ; var query = Path . extractQuery ( transition . path ) || { } ; var state = { path : transition . path , matches : nextMatches , activeParams : params , activeQuery : query , activeRoutes : nextMatches . map ( function ( match ) { return match . route ; } ) } ; routes . setState ( state ) ; return state ; } ) ; } ) ; }
Runs all transition hooks that are required to get from the current state
 to the state specified by the given transition and updates the current state
 if they all pass successfully.
Runs all transition hooks that are required to get from the current state to the state specified by the given transition and updates the current state if they all pass successfully .
// Nothing to do! // No need to continue. // No need to continue.