-
Notifications
You must be signed in to change notification settings - Fork 26.5k
fix(router): ensure preloaded components are properly activated #62502
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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