-
Notifications
You must be signed in to change notification settings - Fork 25.9k
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
perf(core): do not recurse into modules that have already been registered #39514
Conversation
6fe6a7f
to
4e57dee
Compare
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.
Nice optimization @JoostK 👍 (just left 1 minor comment)
const visited = new Set<NgModuleType>(); | ||
recurse(ngModuleType); | ||
function recurse(ngModuleType: NgModuleType): void { | ||
const def = getNgModuleDef(ngModuleType, true); |
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.
const def = getNgModuleDef(ngModuleType, true); | |
const def = getNgModuleDef(ngModuleType, /* throwNotFound */ true); |
May be also add a quick comment on why it's safe to throw if moduleDef is not found?
…ered When registering an NgModule based on its id, all transitively imported NgModules are also registered. This commit introduces a visited set to avoid traversing into NgModules that are reachable from multiple import paths multiple times. Fixes angular#39487
af1412e
to
2b05235
Compare
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. |
When registering an NgModule based on its id, all transitively imported
NgModules are also registered. This commit introduces a visited set to
avoid traversing into NgModules that are reachable from multiple import
paths multiple times.
Fixes #39487