@angular/router 12.2.1 → 12.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.2.1
2
+ * @license Angular v12.2.5
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.2.1
2
+ * @license Angular v12.2.5
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.2.1
2
+ * @license Angular v12.2.5
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4419,7 +4419,7 @@
4419
4419
  return rxjs.of(null);
4420
4420
  }
4421
4421
  /**
4422
- * The equivalent `IsActiveUrlTreeOptions` options for `Router.isActive` is called with `true`
4422
+ * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `true`
4423
4423
  * (exact = true).
4424
4424
  */
4425
4425
  var exactMatchOptions = {
@@ -4429,7 +4429,7 @@
4429
4429
  queryParams: 'exact'
4430
4430
  };
4431
4431
  /**
4432
- * The equivalent `IsActiveUrlTreeOptions` options for `Router.isActive` is called with `false`
4432
+ * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `false`
4433
4433
  * (exact = false).
4434
4434
  */
4435
4435
  var subsetMatchOptions = {
@@ -4650,6 +4650,11 @@
4650
4650
  t.extractedUrl.toString() !== _this.browserUrlTree.toString();
4651
4651
  var processCurrentUrl = (_this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4652
4652
  _this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4653
+ // If the source of the navigation is from a browser event, the URL is
4654
+ // already updated. We already need to sync the internal state.
4655
+ if (isBrowserTriggeredNavigation(t.source)) {
4656
+ _this.browserUrlTree = t.rawUrl;
4657
+ }
4653
4658
  if (processCurrentUrl) {
4654
4659
  return rxjs.of(t).pipe(
4655
4660
  // Fire NavigationStart event
@@ -4881,7 +4886,12 @@
4881
4886
  var mergedTree = _this.urlHandlingStrategy.merge(e.url, _this.rawUrlTree);
4882
4887
  var extras = {
4883
4888
  skipLocationChange: t.extras.skipLocationChange,
4884
- replaceUrl: _this.urlUpdateStrategy === 'eager'
4889
+ // The URL is already updated at this point if we have 'eager' URL
4890
+ // updates or if the navigation was triggered by the browser (back
4891
+ // button, URL bar, etc). We want to replace that item in history if
4892
+ // the navigation is rejected.
4893
+ replaceUrl: _this.urlUpdateStrategy === 'eager' ||
4894
+ isBrowserTriggeredNavigation(t.source)
4885
4895
  };
4886
4896
  _this.scheduleNavigation(mergedTree, 'imperative', null, extras, { resolve: t.resolve, reject: t.reject, promise: t.promise });
4887
4897
  }, 0);
@@ -5247,7 +5257,7 @@
5247
5257
  _this.lastSuccessfulNavigation = _this.currentNavigation;
5248
5258
  t.resolve(true);
5249
5259
  }, function (e) {
5250
- _this.console.warn("Unhandled Navigation Error: ");
5260
+ _this.console.warn("Unhandled Navigation Error: " + e);
5251
5261
  });
5252
5262
  };
5253
5263
  Router.prototype.scheduleNavigation = function (rawUrl, source, restoredState, extras, priorPromise) {
@@ -5267,7 +5277,8 @@
5267
5277
  var lastNavigation = this.getTransition();
5268
5278
  // We don't want to skip duplicate successful navs if they're imperative because
5269
5279
  // onSameUrlNavigation could be 'reload' (so the duplicate is intended).
5270
- var browserNavPrecededByRouterNav = source !== 'imperative' && (lastNavigation === null || lastNavigation === void 0 ? void 0 : lastNavigation.source) === 'imperative';
5280
+ var browserNavPrecededByRouterNav = isBrowserTriggeredNavigation(source) && lastNavigation &&
5281
+ !isBrowserTriggeredNavigation(lastNavigation.source);
5271
5282
  var lastNavigationSucceeded = this.lastSuccessfulId === lastNavigation.id;
5272
5283
  // If the last navigation succeeded or is in flight, we can use the rawUrl as the comparison.
5273
5284
  // However, if it failed, we should compare to the final result (urlAfterRedirects).
@@ -5438,6 +5449,9 @@
5438
5449
  }
5439
5450
  }
5440
5451
  }
5452
+ function isBrowserTriggeredNavigation(source) {
5453
+ return source !== 'imperative';
5454
+ }
5441
5455
 
5442
5456
  /**
5443
5457
  * @license
@@ -6733,7 +6747,7 @@
6733
6747
  /**
6734
6748
  * @publicApi
6735
6749
  */
6736
- var VERSION = new core.Version('12.2.1');
6750
+ var VERSION = new core.Version('12.2.5');
6737
6751
 
6738
6752
  /**
6739
6753
  * @license