fix(@schematics/angular): do not add changeDetection in default template#32752
fix(@schematics/angular): do not add changeDetection in default template#32752cexbrayat wants to merge 1 commit intoangular:mainfrom
Conversation
As the new default is `Eager`, the CLI was adding `changeDetection: ChangeDetectionStrategy.Eager` in every component
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where the default change detection strategy (Eager) was explicitly added to generated components. The component template is updated to avoid adding the changeDetection property when the strategy is 'Eager'. A new test case is included to verify this behavior. The changes appear correct and align with the goal of not specifying the default change detection strategy in the generated code.
There was a problem hiding this comment.
This is intended as ChangeDetectionStrategy.Eager needs to be explicitly set. We should not add ChangeDetectionStrategy.OnPush which is now the default instead.
Maybe we should also update the schematics default to OnPush to align with the FW default.
|
@alan-agius4 Thanks for your feedback, I'll close this one and opened #32753 instead which switches the default to OnPush and don't add it to the decorator when that's the case. |
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
As the new default is
Eager, the CLI was addingchangeDetection: ChangeDetectionStrategy.Eagerin every componentDoes this PR introduce a breaking change?
Other information