Skip to content

Commit 75725fb

Browse files
atscottalxhub
authored andcommitted
docs(core): Deprecate ChangeDetectorRef.checkNoChanges (angular#52431)
The `checkNoChanges` method does not belong in the API of production interface. `checkNoChanges` is limited to testing and should not be used in any application code. Test code should use `ComponentFixture` instead of `ChangeDetectorRef`. Additionally, it is not desirable to have the `checkNoChanges` API available in a context where `detectChanges` is not run first. DEPRECATED: `ChangeDetectorRef.checkNoChanges` is deprecated. Test code should use `ComponentFixture` instead of `ChangeDetectorRef`. Application code should not call `ChangeDetectorRef.checkNoChanges` directly. PR Close angular#52431
1 parent 245a6b3 commit 75725fb

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

goldens/public-api/core/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export enum ChangeDetectionStrategy {
168168

169169
// @public
170170
export abstract class ChangeDetectorRef {
171+
// @deprecated
171172
abstract checkNoChanges(): void;
172173
abstract detach(): void;
173174
abstract detectChanges(): void;

packages/core/src/change_detection/change_detector_ref.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ export abstract class ChangeDetectorRef {
104104
*
105105
* Use in development mode to verify that running change detection doesn't introduce
106106
* other changes. Calling it in production mode is a noop.
107+
*
108+
* @deprecated This is a test-only API that does not have a place in production interface.
109+
* `checkNoChanges` is already part of an `ApplicationRef` tick when the app is running in dev
110+
* mode. For more granular `checkNoChanges` validation, use `ComponentFixture`.
107111
*/
108112
abstract checkNoChanges(): void;
109113

0 commit comments

Comments
 (0)