@angular/router 12.2.3 → 12.2.7

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.3');
17
+ export const VERSION = new Version('12.2.7');
18
18
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3JvdXRlci9zcmMvdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSDs7OztHQUlHO0FBRUgsT0FBTyxFQUFDLE9BQU8sRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUV0Qzs7R0FFRztBQUNILE1BQU0sQ0FBQyxNQUFNLE9BQU8sR0FBRyxJQUFJLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBMTEMgQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZSB0aGF0IGNhbiBiZVxuICogZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZSBhdCBodHRwczovL2FuZ3VsYXIuaW8vbGljZW5zZVxuICovXG5cbi8qKlxuICogQG1vZHVsZVxuICogQGRlc2NyaXB0aW9uXG4gKiBFbnRyeSBwb2ludCBmb3IgYWxsIHB1YmxpYyBBUElzIG9mIHRoZSByb3V0ZXIgcGFja2FnZS5cbiAqL1xuXG5pbXBvcnQge1ZlcnNpb259IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG4vKipcbiAqIEBwdWJsaWNBcGlcbiAqL1xuZXhwb3J0IGNvbnN0IFZFUlNJT04gPSBuZXcgVmVyc2lvbignMC4wLjAtUExBQ0VIT0xERVInKTtcbiJdfQ==
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.2.3
2
+ * @license Angular v12.2.7
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 = {
@@ -4048,16 +4048,22 @@ class Router {
4048
4048
  null
4049
4049
  };
4050
4050
  }), switchMap(t => {
4051
+ const browserUrlTree = this.browserUrlTree.toString();
4051
4052
  const urlTransition = !this.navigated ||
4052
- t.extractedUrl.toString() !== this.browserUrlTree.toString();
4053
+ t.extractedUrl.toString() !== browserUrlTree ||
4054
+ // Navigations which succeed or ones which fail and are cleaned up
4055
+ // correctly should result in `browserUrlTree` and `currentUrlTree`
4056
+ // matching. If this is not the case, assume something went wrong and try
4057
+ // processing the URL again.
4058
+ browserUrlTree !== this.currentUrlTree.toString();
4053
4059
  const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4054
4060
  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
- }
4060
4061
  if (processCurrentUrl) {
4062
+ // If the source of the navigation is from a browser event, the URL is
4063
+ // already updated. We already need to sync the internal state.
4064
+ if (isBrowserTriggeredNavigation(t.source)) {
4065
+ this.browserUrlTree = t.extractedUrl;
4066
+ }
4061
4067
  return of(t).pipe(
4062
4068
  // Fire NavigationStart event
4063
4069
  switchMap(t => {
@@ -4083,6 +4089,13 @@ class Router {
4083
4089
  if (this.urlUpdateStrategy === 'eager') {
4084
4090
  if (!t.extras.skipLocationChange) {
4085
4091
  this.setBrowserUrl(t.urlAfterRedirects, t);
4092
+ // TODO(atscott): The above line is incorrect. It sets the url to
4093
+ // only the part that is handled by the router. It should merge
4094
+ // that with the rawUrl so the url includes segments not handled
4095
+ // by the router:
4096
+ // const rawUrl = this.urlHandlingStrategy.merge(
4097
+ // t.urlAfterRedirects, t.rawUrl);
4098
+ // this.setBrowserUrl(rawUrl, t);
4086
4099
  }
4087
4100
  this.browserUrlTree = t.urlAfterRedirects;
4088
4101
  }
@@ -4194,7 +4207,7 @@ class Router {
4194
4207
  tap((t) => {
4195
4208
  this.currentUrlTree = t.urlAfterRedirects;
4196
4209
  this.rawUrlTree =
4197
- this.urlHandlingStrategy.merge(this.currentUrlTree, t.rawUrl);
4210
+ this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4198
4211
  this.routerState = t.targetRouterState;
4199
4212
  if (this.urlUpdateStrategy === 'deferred') {
4200
4213
  if (!t.extras.skipLocationChange) {
@@ -4329,6 +4342,12 @@ class Router {
4329
4342
  }
4330
4343
  getTransition() {
4331
4344
  const transition = this.transitions.value;
4345
+ // TODO(atscott): This comment doesn't make it clear why this value needs to be set. In the case
4346
+ // described below (where we don't handle previous or current url), the `browserUrlTree` is set
4347
+ // to the `urlAfterRedirects` value. However, these values *are already the same* because of the
4348
+ // line below. So it seems that we should be able to remove the line below and the line where
4349
+ // `browserUrlTree` is updated when we aren't handling any part of the navigation url.
4350
+ // Run TGP to confirm that this can be done.
4332
4351
  // This value needs to be set. Other values such as extractedUrl are set on initial navigation
4333
4352
  // but the urlAfterRedirects may not get set if we aren't processing the new URL *and* not
4334
4353
  // processing the previous URL.
@@ -4650,7 +4669,7 @@ class Router {
4650
4669
  this.lastSuccessfulNavigation = this.currentNavigation;
4651
4670
  t.resolve(true);
4652
4671
  }, e => {
4653
- this.console.warn(`Unhandled Navigation Error: `);
4672
+ this.console.warn(`Unhandled Navigation Error: ${e}`);
4654
4673
  });
4655
4674
  }
4656
4675
  scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
@@ -6074,7 +6093,7 @@ function provideRouterInitializer() {
6074
6093
  /**
6075
6094
  * @publicApi
6076
6095
  */
6077
- const VERSION = new Version('12.2.3');
6096
+ const VERSION = new Version('12.2.7');
6078
6097
 
6079
6098
  /**
6080
6099
  * @license