From 7a07f03eaccc590047be9f98597428c1cb8e6d61 Mon Sep 17 00:00:00 2001 From: Miles Malerba Date: Thu, 20 Jun 2024 16:55:35 -0700 Subject: [PATCH] fix(multiple): remove workarounds for formControl directive The formControl directive previously did not mark itself for check, so several components that work closely with this directive marked for check on its behalf as a workaround. Now that the directive is fixed we can remove the workarounds. --- src/material/autocomplete/autocomplete-trigger.ts | 1 - src/material/chips/chip-grid.ts | 12 +----------- src/material/radio/radio.ts | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/material/autocomplete/autocomplete-trigger.ts b/src/material/autocomplete/autocomplete-trigger.ts index 45211bb28e19..2652fb99a3db 100644 --- a/src/material/autocomplete/autocomplete-trigger.ts +++ b/src/material/autocomplete/autocomplete-trigger.ts @@ -462,7 +462,6 @@ export class MatAutocompleteTrigger // Implemented as part of ControlValueAccessor. setDisabledState(isDisabled: boolean) { this._element.nativeElement.disabled = isDisabled; - this._changeDetectorRef.markForCheck(); } _handleKeydown(event: KeyboardEvent): void { diff --git a/src/material/chips/chip-grid.ts b/src/material/chips/chip-grid.ts index 32e9cb47d8e8..d28ea15f5b66 100644 --- a/src/material/chips/chip-grid.ts +++ b/src/material/chips/chip-grid.ts @@ -21,7 +21,6 @@ import { EventEmitter, Input, OnDestroy, - OnInit, Optional, Output, QueryList, @@ -91,8 +90,7 @@ export class MatChipGrid ControlValueAccessor, DoCheck, MatFormFieldControl, - OnDestroy, - OnInit + OnDestroy { /** * Implemented as part of MatFormFieldControl. @@ -280,14 +278,6 @@ export class MatChipGrid ); } - ngOnInit() { - if (this.ngControl) { - this.ngControl.control?.events.pipe(takeUntil(this._destroyed)).subscribe(() => { - this._changeDetectorRef.markForCheck(); - }); - } - } - ngAfterContentInit() { this.chipBlurChanges.pipe(takeUntil(this._destroyed)).subscribe(() => { this._blur(); diff --git a/src/material/radio/radio.ts b/src/material/radio/radio.ts index e163988bfdbf..7108df397158 100644 --- a/src/material/radio/radio.ts +++ b/src/material/radio/radio.ts @@ -275,7 +275,6 @@ export class MatRadioGroup implements AfterContentInit, OnDestroy, ControlValueA _touch() { if (this.onTouched) { this.onTouched(); - this._changeDetector.markForCheck(); } }