_preRouteHandler(ctx, next) {
    // We're not really navigating anywhere, so don't do anything.
    if (this._lastContext && this._lastContext.path &&
      ctx.path === this._lastContext.path) {
      Object.assign(ctx, this._lastContext);
      // Set ctx.handled to false, so we don't push the state to browser's
      // history.
      ctx.handled = false;
      return;
    }

    // Check if there were forms with unsaved data before loading the next
    // page.
    const discardMessage = this._confirmDiscardMessage();
    if (discardMessage && !confirm(discardMessage)) {
      Object.assign(ctx, this._lastContext);
      // Set ctx.handled to false, so we don't push the state to browser's
      // history.
      ctx.handled = false;
      // We don't call next to avoid loading whatever page was supposed to
      // load next.
      return;
    }

    // Run query string parsing on all routes. Query params must be parsed
    // before routes are loaded because some routes use them to conditionally
    // load bundles.
    // Based on: https://visionmedia.github.io/page.js/#plugins
    const params = qs.parse(ctx.querystring);

    // Make sure queryParams are not case sensitive.
    const lowerCaseParams = {};
    Object.keys(params).forEach((key) => {
      lowerCaseParams[key.toLowerCase()] = params[key];
    });
    ctx.queryParams = lowerCaseParams;

    this._selectProject(ctx.params.project);

    next();
  }
/**
   * Handler that runs on every single route change, before the new page has
   * loaded. This function should not use store.dispatch() or assign properties
   * on this because running these actions causes extra re-renders to happen.
   * @param {PageJS.Context} ctx A page.js Context containing routing state.
   * @param {function} next Passes execution on to the next registered callback.
   */
Handler that runs on every single route change, before the new page has
loaded. This function should not use store.dispatch() or assign properties
on this because running these actions causes extra re-renders to happen.
Handler that runs on every single route change before the new page has loaded . This function should not use store . dispatch () or assign properties on this because running these actions causes extra re - renders to happen .
_preRouteHandler(ctx, next) {
    if (this._lastContext && this._lastContext.path &&
      ctx.path === this._lastContext.path) {
      Object.assign(ctx, this._lastContext);
      ctx.handled = false;
      return;
    }
    const discardMessage = this._confirmDiscardMessage();
    if (discardMessage && !confirm(discardMessage)) {
      Object.assign(ctx, this._lastContext);
      ctx.handled = false;
      return;
    }
    const params = qs.parse(ctx.querystring);
    const lowerCaseParams = {};
    Object.keys(params).forEach((key) => {
      lowerCaseParams[key.toLowerCase()] = params[key];
    });
    ctx.queryParams = lowerCaseParams;
    this._selectProject(ctx.params.project);
    next();
  }
_preRouteHandler ( ctx , next ) { if ( this . _lastContext && this . _lastContext . path && ctx . path === this . _lastContext . path ) { Object . assign ( ctx , this . _lastContext ) ; ctx . handled = false ; return ; } const discardMessage = this . _confirmDiscardMessage ( ) ; if ( discardMessage && ! confirm ( discardMessage ) ) { Object . assign ( ctx , this . _lastContext ) ; ctx . handled = false ; return ; } const params = qs . parse ( ctx . querystring ) ; const lowerCaseParams = { } ; Object . keys ( params ) . forEach ( ( key ) => { lowerCaseParams [ key . toLowerCase ( ) ] = params [ key ] ; } ) ; ctx . queryParams = lowerCaseParams ; this . _selectProject ( ctx . params . project ) ; next ( ) ; }
Handler that runs on every single route change, before the new page has
 loaded.
Handler that runs on every single route change before the new page has loaded .
// We're not really navigating anywhere, so don't do anything. // Set ctx.handled to false, so we don't push the state to browser's // history. // Check if there were forms with unsaved data before loading the next // page. // Set ctx.handled to false, so we don't push the state to browser's // history. // We don't call next to avoid loading whatever page was supposed to // load next. // Run query string parsing on all routes. Query params must be parsed // before routes are loaded because some routes use them to conditionally // load bundles. // Based on: https://visionmedia.github.io/page.js/#plugins // Make sure queryParams are not case sensitive.