fix(ivy): register `ModuleWithProviders` when deduplicating imported modules (#27268)
PR Close #27268
This commit is contained in:
parent
c2f30542e7
commit
32157115da
|
@ -227,9 +227,7 @@ export class R3Injector {
|
|||
}
|
||||
|
||||
// Check for multiple imports of the same module
|
||||
if (dedupStack.indexOf(defType) !== -1) {
|
||||
return;
|
||||
}
|
||||
const isDuplicate = dedupStack.indexOf(defType) !== -1;
|
||||
|
||||
// If defOrWrappedType was an InjectorDefTypeWithProviders, then .providers may hold some
|
||||
// extra providers.
|
||||
|
@ -255,7 +253,7 @@ export class R3Injector {
|
|||
// Add providers in the same way that @NgModule resolution did:
|
||||
|
||||
// First, include providers from any imports.
|
||||
if (def.imports != null) {
|
||||
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.
|
||||
ngDevMode && parents.push(defType);
|
||||
|
@ -272,7 +270,7 @@ export class R3Injector {
|
|||
}
|
||||
|
||||
// Next, include providers listed on the definition itself.
|
||||
if (def.providers != null) {
|
||||
if (def.providers != null && !isDuplicate) {
|
||||
deepForEach(def.providers, provider => this.processProvider(provider));
|
||||
}
|
||||
|
||||
|
|
|
@ -624,15 +624,14 @@ class HiddenModule {
|
|||
});
|
||||
}));
|
||||
|
||||
fixmeIvy('to investigate') &&
|
||||
it('should handle element property "name"', async(() => {
|
||||
renderModule(NameModule, {document: doc}).then(output => {
|
||||
expect(output).toBe(
|
||||
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">' +
|
||||
'<input name=""></app></body></html>');
|
||||
called = true;
|
||||
});
|
||||
}));
|
||||
it('should handle element property "name"', async(() => {
|
||||
renderModule(NameModule, {document: doc}).then(output => {
|
||||
expect(output).toBe(
|
||||
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">' +
|
||||
'<input name=""></app></body></html>');
|
||||
called = true;
|
||||
});
|
||||
}));
|
||||
|
||||
fixmeIvy('to investigate') &&
|
||||
it('should work with sanitizer to handle "innerHTML"', async(() => {
|
||||
|
@ -648,15 +647,14 @@ class HiddenModule {
|
|||
});
|
||||
}));
|
||||
|
||||
fixmeIvy('to investigate') &&
|
||||
it('should handle element property "hidden"', async(() => {
|
||||
renderModule(HiddenModule, {document: doc}).then(output => {
|
||||
expect(output).toBe(
|
||||
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">' +
|
||||
'<input hidden=""><input></app></body></html>');
|
||||
called = true;
|
||||
});
|
||||
}));
|
||||
it('should handle element property "hidden"', async(() => {
|
||||
renderModule(HiddenModule, {document: doc}).then(output => {
|
||||
expect(output).toBe(
|
||||
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">' +
|
||||
'<input hidden=""><input></app></body></html>');
|
||||
called = true;
|
||||
});
|
||||
}));
|
||||
|
||||
it('should call render hook', async(() => {
|
||||
renderModule(RenderHookModule, {document: doc}).then(output => {
|
||||
|
|
Loading…
Reference in New Issue