Skip to content
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

fix(ivy): add back ngDevMode to r3_injector #30707

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/core/src/di/r3_injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/

import '../util/ng_dev_mode';
AndrewKushnir marked this conversation as resolved.
Show resolved Hide resolved

import {OnDestroy} from '../interface/lifecycle_hooks';
import {Type} from '../interface/type';
import {throwCyclicDependencyError, throwInvalidProviderError, throwMixedMultiProviderError} from '../render3/errors';
Expand Down Expand Up @@ -249,8 +251,7 @@ export class R3Injector {
(ngModule === undefined) ? (defOrWrappedDef as InjectorType<any>) : ngModule;

// Check for circular dependencies.
// TODO(FW-1307): Re-add ngDevMode when closure can handle it
if (parents.indexOf(defType) !== -1) {
if (ngDevMode && parents.indexOf(defType) !== -1) {
const defName = stringify(defType);
throw new Error(
`Circular dependency in DI detected for type ${defName}. Dependency path: ${parents.map(defType => stringify(defType)).join(' > ')} > ${defName}.`);
Expand Down Expand Up @@ -286,8 +287,7 @@ export class R3Injector {
if (def.imports != null && !isDuplicate) {
// Before processing defType's imports, add it to the set of parents. This way, if it ends
// up deeply importing itself, this can be detected.
// TODO(FW-1307): Re-add ngDevMode when closure can handle it
parents.push(defType);
ngDevMode && parents.push(defType);
// Add it to the set of dedups. This way we can detect multiple imports of the same module
dedupStack.push(defType);

Expand All @@ -296,8 +296,7 @@ export class R3Injector {
def.imports, imported => this.processInjectorType(imported, parents, dedupStack));
} finally {
// Remove it from the parents set when finished.
// TODO(FW-1307): Re-add ngDevMode when closure can handle it
parents.pop();
ngDevMode && parents.pop();
}
}

Expand Down