fix(core): Respect OnPush change detection strategy for dynamically c…#51356
Closed
atscott wants to merge 1 commit intoangular:mainfrom
Closed
fix(core): Respect OnPush change detection strategy for dynamically c…#51356atscott wants to merge 1 commit intoangular:mainfrom
atscott wants to merge 1 commit intoangular:mainfrom
Conversation
pkozlowski-opensource
approved these changes
Aug 19, 2023
Contributor
Author
|
Caretaker note: Currently blocked due to a few internal failures that need to be resolved. |
Contributor
Author
|
another green TGP |
…reated components 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`.
66da524 to
f93d024
Compare
Contributor
|
This PR was merged into the repository by commit 40bb45f. |
LayZeeDK
pushed a commit
to LayZeeDK/angular__angular
that referenced
this pull request
Sep 20, 2023
…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
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
ChellappanRajan
pushed a commit
to ChellappanRajan/angular
that referenced
this pull request
Jan 23, 2024
…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
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


…reated components
This commit fixes a bug in the change detection algorithm that would ignore the
OnPush/dirty flag of a component view when it is created dynamically. That is,OnPushcomponents that were not marked dirty but were created as embedded views would always be refreshed even if they were not dirty.BREAKING CHANGE:
OnPushcomponents that are created dynamically are now only refreshed during change detection if they are dirty. Previously, a bug in the change detection would result in theOnPushconfiguration of dynamically created components to be ignored. This is rarely encountered but can happen if code has a handle on theComponentRefinstance and updates values read in theOnPushcomponent template without then calling eithermarkForCheckordetectChangeson that component'sChangeDetectorRef.