forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Respect OnPush change detection strategy for dynamically c…
…reated components (angular#51356) This commit fixes a bug in the change detection algorithm that would ignore the `OnPush`/dirty flag of a component's host when it is created dynamically. That is, `OnPush` components that were not marked dirty but were created as embedded views would have their host bindings and `ngDoCheck` function always run even if they were not dirty. BREAKING CHANGE: `OnPush` components that are created dynamically now only have their host bindings refreshed and `ngDoCheck run` during change detection if they are dirty. Previously, a bug in the change detection would result in the `OnPush` configuration of dynamically created components to be ignored when executing host bindings and the `ngDoCheck` function. This is rarely encountered but can happen if code has a handle on the `ComponentRef` instance and updates values read in the `OnPush` component template without then calling either `markForCheck` or `detectChanges` on that component's `ChangeDetectorRef`. PR Close angular#51356
- Loading branch information
1 parent
b37ba05
commit 40bb45f
Showing
2 changed files
with
36 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters