Skip to content

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

Merged
alan-agius4 merged 1 commit into
angular: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 into
angular:mainfrom
cexbrayat:fix/component-change-detection-onpush-default

Conversation

@cexbrayat

Copy link
Copy Markdown
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

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks

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

Copy link
Copy Markdown

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
Copy Markdown
Collaborator

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

@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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