@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.
@@ -14,5 +14,5 @@ import { Version } from '@angular/core';
14
14
  /**
15
15
  * @publicApi
16
16
  */
17
- export const VERSION = new Version('12.2.1');
17
+ export const VERSION = new Version('12.2.5');
18
18
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3JvdXRlci9zcmMvdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSDs7OztHQUlHO0FBRUgsT0FBTyxFQUFDLE9BQU8sRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUV0Qzs7R0FFRztBQUNILE1BQU0sQ0FBQyxNQUFNLE9BQU8sR0FBRyxJQUFJLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBMTEMgQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZSB0aGF0IGNhbiBiZVxuICogZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZSBhdCBodHRwczovL2FuZ3VsYXIuaW8vbGljZW5zZVxuICovXG5cbi8qKlxuICogQG1vZHVsZVxuICogQGRlc2NyaXB0aW9uXG4gKiBFbnRyeSBwb2ludCBmb3IgYWxsIHB1YmxpYyBBUElzIG9mIHRoZSByb3V0ZXIgcGFja2FnZS5cbiAqL1xuXG5pbXBvcnQge1ZlcnNpb259IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG4vKipcbiAqIEBwdWJsaWNBcGlcbiAqL1xuZXhwb3J0IGNvbnN0IFZFUlNJT04gPSBuZXcgVmVyc2lvbignMC4wLjAtUExBQ0VIT0xERVInKTtcbiJdfQ==
@@ -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
  */
@@ -3827,7 +3827,7 @@ function defaultRouterHook(snapshot, runExtras) {
3827
3827
  return of(null);
3828
3828
  }
3829
3829
  /**
3830
- * The equivalent `IsActiveUrlTreeOptions` options for `Router.isActive` is called with `true`
3830
+ * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `true`
3831
3831
  * (exact = true).
3832
3832
  */
3833
3833
  const exactMatchOptions = {
@@ -3837,7 +3837,7 @@ const exactMatchOptions = {
3837
3837
  queryParams: 'exact'
3838
3838
  };
3839
3839
  /**
3840
- * The equivalent `IsActiveUrlTreeOptions` options for `Router.isActive` is called with `false`
3840
+ * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `false`
3841
3841
  * (exact = false).
3842
3842
  */
3843
3843
  const subsetMatchOptions = {
@@ -4052,6 +4052,11 @@ class Router {
4052
4052
  t.extractedUrl.toString() !== this.browserUrlTree.toString();
4053
4053
  const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4054
4054
  this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4055
+ // If the source of the navigation is from a browser event, the URL is
4056
+ // already updated. We already need to sync the internal state.
4057
+ if (isBrowserTriggeredNavigation(t.source)) {
4058
+ this.browserUrlTree = t.rawUrl;
4059
+ }
4055
4060
  if (processCurrentUrl) {
4056
4061
  return of(t).pipe(
4057
4062
  // Fire NavigationStart event
@@ -4283,7 +4288,12 @@ class Router {
4283
4288
  const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
4284
4289
  const extras = {
4285
4290
  skipLocationChange: t.extras.skipLocationChange,
4286
- replaceUrl: this.urlUpdateStrategy === 'eager'
4291
+ // The URL is already updated at this point if we have 'eager' URL
4292
+ // updates or if the navigation was triggered by the browser (back
4293
+ // button, URL bar, etc). We want to replace that item in history if
4294
+ // the navigation is rejected.
4295
+ replaceUrl: this.urlUpdateStrategy === 'eager' ||
4296
+ isBrowserTriggeredNavigation(t.source)
4287
4297
  };
4288
4298
  this.scheduleNavigation(mergedTree, 'imperative', null, extras, { resolve: t.resolve, reject: t.reject, promise: t.promise });
4289
4299
  }, 0);
@@ -4640,7 +4650,7 @@ class Router {
4640
4650
  this.lastSuccessfulNavigation = this.currentNavigation;
4641
4651
  t.resolve(true);
4642
4652
  }, e => {
4643
- this.console.warn(`Unhandled Navigation Error: `);
4653
+ this.console.warn(`Unhandled Navigation Error: ${e}`);
4644
4654
  });
4645
4655
  }
4646
4656
  scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
@@ -4660,7 +4670,8 @@ class Router {
4660
4670
  const lastNavigation = this.getTransition();
4661
4671
  // We don't want to skip duplicate successful navs if they're imperative because
4662
4672
  // onSameUrlNavigation could be 'reload' (so the duplicate is intended).
4663
- const browserNavPrecededByRouterNav = source !== 'imperative' && (lastNavigation === null || lastNavigation === void 0 ? void 0 : lastNavigation.source) === 'imperative';
4673
+ const browserNavPrecededByRouterNav = isBrowserTriggeredNavigation(source) && lastNavigation &&
4674
+ !isBrowserTriggeredNavigation(lastNavigation.source);
4664
4675
  const lastNavigationSucceeded = this.lastSuccessfulId === lastNavigation.id;
4665
4676
  // If the last navigation succeeded or is in flight, we can use the rawUrl as the comparison.
4666
4677
  // However, if it failed, we should compare to the final result (urlAfterRedirects).
@@ -4829,6 +4840,9 @@ function validateCommands(commands) {
4829
4840
  }
4830
4841
  }
4831
4842
  }
4843
+ function isBrowserTriggeredNavigation(source) {
4844
+ return source !== 'imperative';
4845
+ }
4832
4846
 
4833
4847
  /**
4834
4848
  * @license
@@ -6060,7 +6074,7 @@ function provideRouterInitializer() {
6060
6074
  /**
6061
6075
  * @publicApi
6062
6076
  */
6063
- const VERSION = new Version('12.2.1');
6077
+ const VERSION = new Version('12.2.5');
6064
6078
 
6065
6079
  /**
6066
6080
  * @license