Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(router): Do not call preload method when not necessary
In Angular 14, we introduced the `loadComponent` API for a `Route` to allow lazy loading of a routed component in addition to the existing `loadChildren` which allows lazy loading of child routes. As a result, the `preload` method of the `PreloadingStrategy` needs to sometimes be called even when there is a `canLoad` guard on the `Route`. `CanLoad` guards block loading of child routes but _do not_ block loading of the component. This change updates the conditional checks in the internal preloader to skip calling the `PreloadingStrategy.preload` when there is only a `loadChildren` callback with a `canLoad` guard an no `loadComponent`. In this case, the callback passed to the `preload` method is already effectively a no-op so it's not necessary to call it at all. resolves #47003
- Loading branch information
Showing
3 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters