fix(upgrade): correctly handle downgraded OnPush
components (#22209)
Fixes #14286 PR Close #22209
This commit is contained in:

committed by
Alex Rickabaugh

parent
7a1c43733b
commit
ad9ce5cb41
@ -25,6 +25,7 @@ export class DowngradeComponentAdapter {
|
||||
private componentRef: ComponentRef<any>;
|
||||
private component: any;
|
||||
private changeDetector: ChangeDetectorRef;
|
||||
private viewChangeDetector: ChangeDetectorRef;
|
||||
|
||||
constructor(
|
||||
private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes,
|
||||
@ -60,6 +61,7 @@ export class DowngradeComponentAdapter {
|
||||
|
||||
this.componentRef =
|
||||
this.componentFactory.create(childInjector, projectableNodes, this.element[0]);
|
||||
this.viewChangeDetector = this.componentRef.injector.get(ChangeDetectorRef);
|
||||
this.changeDetector = this.componentRef.changeDetectorRef;
|
||||
this.component = this.componentRef.instance;
|
||||
|
||||
@ -139,6 +141,8 @@ export class DowngradeComponentAdapter {
|
||||
(<OnChanges>this.component).ngOnChanges(inputChanges !);
|
||||
}
|
||||
|
||||
this.viewChangeDetector.markForCheck();
|
||||
|
||||
// If opted out of propagating digests, invoke change detection when inputs change.
|
||||
if (!propagateDigest) {
|
||||
detectChanges();
|
||||
|
Reference in New Issue
Block a user