Skip to content

fix(@schematics/angular): default components to OnPush change detection#32753

Merged
alan-agius4 merged 1 commit intoangular:mainfrom
cexbrayat:fix/component-change-detection-onpush-default
Mar 12, 2026
Merged

fix(@schematics/angular): default components to OnPush change detection#32753
alan-agius4 merged 1 commit intoangular:mainfrom
cexbrayat:fix/component-change-detection-onpush-default

Conversation

@cexbrayat
Copy link
Member

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

The CLI adds Eager to every new component

What is the new behavior?

This defaults the change detection to OnPush, and omits changeDetection in the decorator if the strategy is OnPush

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the Angular component schematic to default the change detection strategy to OnPush. Several test descriptions and assertions need updates to reflect the change to Eager change detection in specific test cases.

@alan-agius4 alan-agius4 added target: major This PR is targeted for the next major release action: merge The PR is ready for merge by the caretaker labels Mar 12, 2026
@alan-agius4 alan-agius4 merged commit 6572a69 into angular:main Mar 12, 2026
37 of 38 checks passed
@alan-agius4
Copy link
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @schematics/angular target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants