You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Breaking undocumented change from Angular 13 to 14 in custom PreloadingStrategy. "preload"-method is called despite a set canLoad-guard. #47003
Version 14 introduced the loadComponent for routes, which is not blocked by canLoad guards. This is why the preload method is still called. That said, the loadChildrenis not called if there is a canLoad guard so I would not consider this a breaking change.
The documentation could use an update and I will also adjust the code to not call the preload method in cases where there is a canLoad and no loadComponent. In this scenario, there is no need to call the preload method since nothing will be done with the result.
@atscott Thank you. That sounds like a good solution. In my case, I wanted to preload the modules only after the user logged in. So I removed the canLoad-guards after the login and called Router.preload() manually.
Activity
atscott commentedon Aug 1, 2022
Version 14 introduced the
loadComponentfor routes, which is not blocked bycanLoadguards. This is why thepreloadmethod is still called. That said, theloadChildrenis not called if there is acanLoadguard so I would not consider this a breaking change.The documentation could use an update and I will also adjust the code to not call the
preloadmethod in cases where there is acanLoadand noloadComponent. In this scenario, there is no need to call thepreloadmethod since nothing will be done with the result.fix(router): Do not call preload method when not necessary
5te1n commentedon Aug 2, 2022
@atscott Thank you. That sounds like a good solution. In my case, I wanted to preload the modules only after the user logged in. So I removed the canLoad-guards after the login and called Router.preload() manually.
fix(router): Do not call preload method when not necessary (#47007)
angular-automatic-lock-bot commentedon Sep 2, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.