Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router): Do not call preload method when not necessary #47007

Closed
wants to merge 1 commit into from

Commits on Aug 1, 2022

  1. 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 angular#47003
    atscott committed Aug 1, 2022
    Copy the full SHA
    ea03bd3 View commit details
    Browse the repository at this point in the history