{{ message }}
Conversation
Contributor
|
Thanks for the PR. Can you please add a test? I would like to confirm this was failing in the past. Looking at the code, I see a |
jasonaden
suggested changes
Jan 9, 2019
jasonaden
left a comment
Contributor
There was a problem hiding this comment.
See comment about adding tests to confirm this is currently broken and this fixes it.
Author
|
I already made stackblitz to reproduce the issue, so you should be able to confirm the issue there. |
Closed
7 tasks
pgammans
added a commit
to pgammans/angular
that referenced
this pull request
Apr 22, 2020
Add four test to check the interaction of PreloadingStrategy and normal router navigation under differing scenarios. Checking: * Prevention of duplicate loading of modules. related to angular#26557 * Prevention of duplicate RouteConfigLoad(Start|End) events related to angular#22842 * Ensuring preload strategy remains active for submodules if needed The selected preload strategy should still decide when to load submodules * Possibility of memory leak with unfinished preload subscription related to angular#26557
pgammans
added a commit
to pgammans/angular
that referenced
this pull request
Apr 22, 2020
Store an observable on the route for the currently outstanding module load factory. The replaces the fix angular#26557 as that allowed overlapping requests to still load the module twice. Fixes angular#26557 angular#22842
pgammans
added a commit
to pgammans/angular
that referenced
this pull request
Apr 23, 2020
Clear the stored loader promise so that subsequent load will try the fetch again. The restores the same behaviour as before we cached the loader to fix angular#26557
Contributor
|
Closing due to the issues mentioned in #36760
|
pgammans
added a commit
to pgammans/angular
that referenced
this pull request
Feb 11, 2021
Fix router to ensure that a route module is only loaded once especially in relation to the use of preload strategies with delayed or partial loading. Add test to check the interaction of PreloadingStrategy and normal router navigation under differing scenarios. Checking: * Prevention of duplicate loading of modules. related to angular#26557 * Prevention of duplicate RouteConfigLoad(Start|End) events related to angular#22842 * Ensuring preload strategy remains active for submodules if needed The selected preload strategy should still decide when to load submodules * Possibility of memory leak with unfinished preload subscription related to angular#26557 * Ensure that the stored loader promise is cleared so that subsequent load will try the fetch again. * Add error handle error from loadChildren * Ensure we handle error from with NgModule create Fixes angular#26557 angular#22842 angular#26557
josephperrott
pushed a commit
that referenced
this pull request
Feb 11, 2021
#40389) Fix router to ensure that a route module is only loaded once especially in relation to the use of preload strategies with delayed or partial loading. Add test to check the interaction of PreloadingStrategy and normal router navigation under differing scenarios. Checking: * Prevention of duplicate loading of modules. related to #26557 * Prevention of duplicate RouteConfigLoad(Start|End) events related to #22842 * Ensuring preload strategy remains active for submodules if needed The selected preload strategy should still decide when to load submodules * Possibility of memory leak with unfinished preload subscription related to #26557 * Ensure that the stored loader promise is cleared so that subsequent load will try the fetch again. * Add error handle error from loadChildren * Ensure we handle error from with NgModule create Fixes #26557 #22842 #26557 PR Close #40389
josephperrott
pushed a commit
that referenced
this pull request
Feb 11, 2021
#40389) Fix router to ensure that a route module is only loaded once especially in relation to the use of preload strategies with delayed or partial loading. Add test to check the interaction of PreloadingStrategy and normal router navigation under differing scenarios. Checking: * Prevention of duplicate loading of modules. related to #26557 * Prevention of duplicate RouteConfigLoad(Start|End) events related to #22842 * Ensuring preload strategy remains active for submodules if needed The selected preload strategy should still decide when to load submodules * Possibility of memory leak with unfinished preload subscription related to #26557 * Ensure that the stored loader promise is cleared so that subsequent load will try the fetch again. * Add error handle error from loadChildren * Ensure we handle error from with NgModule create Fixes #26557 #22842 #26557 PR Close #40389
josephperrott
pushed a commit
that referenced
this pull request
Feb 16, 2021
#40389) Fix router to ensure that a route module is only loaded once especially in relation to the use of preload strategies with delayed or partial loading. Add test to check the interaction of PreloadingStrategy and normal router navigation under differing scenarios. Checking: * Prevention of duplicate loading of modules. related to #26557 * Prevention of duplicate RouteConfigLoad(Start|End) events related to #22842 * Ensuring preload strategy remains active for submodules if needed The selected preload strategy should still decide when to load submodules * Possibility of memory leak with unfinished preload subscription related to #26557 * Ensure that the stored loader promise is cleared so that subsequent load will try the fetch again. * Add error handle error from loadChildren * Ensure we handle error from with NgModule create Fixes #26557 #22842 #26557 PR Close #40389
josephperrott
pushed a commit
that referenced
this pull request
Feb 16, 2021
#40389) Fix router to ensure that a route module is only loaded once especially in relation to the use of preload strategies with delayed or partial loading. Add test to check the interaction of PreloadingStrategy and normal router navigation under differing scenarios. Checking: * Prevention of duplicate loading of modules. related to #26557 * Prevention of duplicate RouteConfigLoad(Start|End) events related to #22842 * Ensuring preload strategy remains active for submodules if needed The selected preload strategy should still decide when to load submodules * Possibility of memory leak with unfinished preload subscription related to #26557 * Ensure that the stored loader promise is cleared so that subsequent load will try the fetch again. * Add error handle error from loadChildren * Ensure we handle error from with NgModule create Fixes #26557 #22842 #26557 PR Close #40389
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When a lazyloaded route is loaded with a user interaction for example, the observable returned by
preloadfrom aPreloadingStrategyis not unsubscribed. Which do not stop the preload strategy from loading the module again.This basic preload strategy load the module twice if the user navigate to the route before 5 seconds:
Reproduced here: https://stackblitz.com/edit/angular-preload-issue
Step to reproduce:
What is the new behavior?
Cancel the preload observable if the route is loaded.
Does this PR introduce a breaking change?
Other information
Also, the observable returned by
load()is not cold, the loading start when the function is called, even if the observable is not subscribed. Is this intended ?angular/packages/router/src/router_config_loader.ts
Lines 47 to 60 in c9488b5
this.loader.load(loadChildren)should be wrapped inside an observable.