Revert "fix(Compiler): relax childIsRecursive check (#8705)"
This fix prevented waiting for child components even if the cycle was only introduced via the `directives` array, i.e. without actually having a cycle. This easily causes issues for applications that have one shared list of directives for all components. This reverts commit 3d5bb2318454ba428b816f6aee6e6aaf427d70a7. Closes #9647
This commit is contained in:
parent
f2f1ec0117
commit
5cc7b41f39
@ -118,9 +118,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
|||||||
this._metadataResolver.getViewDirectivesMetadata(dep.comp.type.runtime);
|
this._metadataResolver.getViewDirectivesMetadata(dep.comp.type.runtime);
|
||||||
let childViewPipes: CompilePipeMetadata[] =
|
let childViewPipes: CompilePipeMetadata[] =
|
||||||
this._metadataResolver.getViewPipesMetadata(dep.comp.type.runtime);
|
this._metadataResolver.getViewPipesMetadata(dep.comp.type.runtime);
|
||||||
let childIsRecursive = childCompilingComponentsPath.indexOf(childCacheKey) > -1 ||
|
let childIsRecursive = childCompilingComponentsPath.indexOf(childCacheKey) > -1;
|
||||||
childViewDirectives.some(
|
|
||||||
dir => childCompilingComponentsPath.indexOf(dir.type.runtime) > -1);
|
|
||||||
childCompilingComponentsPath.push(childCacheKey);
|
childCompilingComponentsPath.push(childCacheKey);
|
||||||
|
|
||||||
let childComp = this._loadAndCompileComponent(
|
let childComp = this._loadAndCompileComponent(
|
||||||
|
@ -12,7 +12,7 @@ import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
|||||||
|
|
||||||
import {IS_DART} from '../../src/facade/lang';
|
import {IS_DART} from '../../src/facade/lang';
|
||||||
|
|
||||||
import {Component, Pipe, PipeTransform, provide, ViewMetadata, PLATFORM_PIPES, OpaqueToken, Injector, forwardRef} from '@angular/core';
|
import {Component, Pipe, PipeTransform, provide, ViewMetadata, OpaqueToken, Injector} from '@angular/core';
|
||||||
import {NgIf, NgClass} from '@angular/common';
|
import {NgIf, NgClass} from '@angular/common';
|
||||||
import {CompilerConfig} from '@angular/compiler';
|
import {CompilerConfig} from '@angular/compiler';
|
||||||
|
|
||||||
@ -170,7 +170,8 @@ function declareTests({useJit}: {useJit: boolean}) {
|
|||||||
|
|
||||||
it('should support ngClass before a component and content projection inside of an ngIf',
|
it('should support ngClass before a component and content projection inside of an ngIf',
|
||||||
inject(
|
inject(
|
||||||
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any) => {
|
[TestComponentBuilder, AsyncTestCompleter],
|
||||||
|
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||||
tcb.overrideView(
|
tcb.overrideView(
|
||||||
MyComp1, new ViewMetadata({
|
MyComp1, new ViewMetadata({
|
||||||
template: `A<cmp-content *ngIf="true" [ngClass]="'red'">B</cmp-content>C`,
|
template: `A<cmp-content *ngIf="true" [ngClass]="'red'">B</cmp-content>C`,
|
||||||
@ -184,15 +185,6 @@ function declareTests({useJit}: {useJit: boolean}) {
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should handle mutual recursion entered from multiple sides - #7084',
|
|
||||||
inject(
|
|
||||||
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any) => {
|
|
||||||
tcb.createAsync(FakeRecursiveComp).then((fixture) => {
|
|
||||||
fixture.detectChanges();
|
|
||||||
expect(fixture.nativeElement).toHaveText('[]');
|
|
||||||
async.done();
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -215,37 +207,3 @@ class CustomPipe implements PipeTransform {
|
|||||||
@Component({selector: 'cmp-content', template: `<ng-content></ng-content>`})
|
@Component({selector: 'cmp-content', template: `<ng-content></ng-content>`})
|
||||||
class CmpWithNgContent {
|
class CmpWithNgContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'left',
|
|
||||||
template: `L<right *ngIf="false"></right>`,
|
|
||||||
directives: [
|
|
||||||
NgIf,
|
|
||||||
forwardRef(() => RightComp),
|
|
||||||
]
|
|
||||||
})
|
|
||||||
class LeftComp {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'right',
|
|
||||||
template: `R<left *ngIf="false"></left>`,
|
|
||||||
directives: [
|
|
||||||
NgIf,
|
|
||||||
forwardRef(() => LeftComp),
|
|
||||||
]
|
|
||||||
})
|
|
||||||
class RightComp {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'fakeRecursiveComp',
|
|
||||||
template: `[<left *ngIf="false"></left><right *ngIf="false"></right>]`,
|
|
||||||
directives: [
|
|
||||||
NgIf,
|
|
||||||
forwardRef(() => LeftComp),
|
|
||||||
forwardRef(() => RightComp),
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class FakeRecursiveComp {
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user