feat(core): Set default Component changeDetection strategy to OnPush#67687
Merged
leonsenft merged 1 commit intoangular:mainfrom Mar 24, 2026
Merged
feat(core): Set default Component changeDetection strategy to OnPush#67687leonsenft merged 1 commit intoangular:mainfrom
leonsenft merged 1 commit intoangular:mainfrom
Conversation
07b5578 to
285c08f
Compare
a4939c4 to
2cab6fa
Compare
59ed1bb to
2dd64a6
Compare
c6d76e2 to
c42c696
Compare
c42c696 to
3b3255a
Compare
3b3255a to
aa57f44
Compare
JeanMeche
commented
Mar 23, 2026
| if ( | ||
| typeof meta.changeDetection === 'number' && | ||
| meta.changeDetection !== core.ChangeDetectionStrategy.Default | ||
| meta.changeDetection !== core.ChangeDetectionStrategy.OnPush |
Member
Author
There was a problem hiding this comment.
I'm highlighting the main changes
1.
JeanMeche
commented
Mar 23, 2026
Comment on lines
107
to
+249
| @@ -242,7 +244,9 @@ export class PartialComponentLinkerVersion1<TStatement, TExpression> | |||
| : ViewEncapsulation.Emulated, | |||
| changeDetection: metaObj.has('changeDetection') | |||
| ? parseChangeDetectionStrategy(metaObj.getValue('changeDetection')) | |||
| : ChangeDetectionStrategy.Default, | |||
| : hasOnPushByDefault | |||
| ? ChangeDetectionStrategy.OnPush | |||
| : ChangeDetectionStrategy.Eager, | |||
JeanMeche
commented
Mar 23, 2026
| animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null, | ||
| defer, | ||
| changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.Default, | ||
| changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.OnPush, |
The default change detection strategy is now OnPush. BREAKING CHANGE: Component with undefined `changeDetection` property are now `OnPush` by default. Specify `changeDetection: ChangeDetectionStrategy.Eager` to keep the previous behavior.
aa57f44 to
e2ba6fc
Compare
josephperrott
approved these changes
Mar 24, 2026
Member
josephperrott
left a comment
There was a problem hiding this comment.
LGTM
Reviewed-for: fw-security
alan-agius4
approved these changes
Mar 24, 2026
Contributor
alan-agius4
left a comment
There was a problem hiding this comment.
LGTM
Reviewed-for: fw-security
alxhub
approved these changes
Mar 24, 2026
Member
Author
|
Caretaker note: Presubmit is a flake this is good to go |
Contributor
|
This PR was merged into the repository. The changes were merged into the following branches:
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The default change detection strategy is now OnPush.
BREAKING CHANGE: Component with undefined
changeDetectionproperty are nowOnPushby default. SpecifychangeDetection: ChangeDetectionStrategy.Eagerto keep the previous behavior.