fix(router): ensure preloaded components are properly activated#62502
fix(router): ensure preloaded components are properly activated#62502dimakuba wants to merge 1 commit intoangular:mainfrom
Conversation
atscott
left a comment
There was a problem hiding this comment.
Right, I misinterpreted the route variable in navigation_transition as Route rather than ActivatedRouteSnapshot. LGTM
| loadComponent: () => of(LazyLoadedStandaloneComponent).pipe(delay(100)), | ||
| canActivate: [() => of(true).pipe(delay(200))], | ||
| }, | ||
| ]); | ||
|
|
||
| router.navigateByUrl('/blank'); | ||
|
|
||
| await advance(fixture); | ||
|
|
||
| routerPreloader.preload(); | ||
|
|
||
| router.navigateByUrl('/lazy'); | ||
|
|
||
| await advance(fixture, 400); |
There was a problem hiding this comment.
Do these delays need to be so large? This test will take half a second, which seems unnecessarily long
There was a problem hiding this comment.
It appears that such large delays are unnecessary. The delays have been reduced
Preloaded components were not being activated in certain scenarios when preloading was enabled. This change ensures that components are correctly activated after being preloaded.
2803c39 to
b3f5756
Compare
|
This PR was merged into the repository by commit 9c45c32. The changes were merged into the following branches: main |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Type
What kind of change does this PR introduce?
What is the current behavior?
This PR addresses an issue where preloaded components are not being activated as expected when preloading is enabled. In certain scenarios, the preloading strategy loads the component, but the route activation does not occur, resulting in the component not being displayed to the user.
What is the new behavior?
This change aims to ensure that preloaded components are properly activated after being loaded.
Does this PR introduce a breaking change?
Other information
Please review this simplified example, which demonstrates the issue. In our production application, we encountered this problem in a more complex scenario: https://stackblitz.com/edit/stackblitz-starters-u44n3ca2?file=package.json