components icon indicating copy to clipboard operation
components copied to clipboard

fix(material/dialog): `mat-dialog-title` should work under `OnPush` `viewContainerRef`

Open atscott opened this issue 1 year ago • 3 comments

The mat-dialog-title directive updates state in a microtask and should call ChangeDetectorRef.markForCheck. Failing to do this will cause the component tree to not be checked if it lives under an OnPush component that has not otherwise been marked for check.

atscott avatar Dec 26 '23 17:12 atscott

@crisbeto PTAL - I had to update the fix to put the ChangeDetectorRef on the dialog container itself because the title also modifies the queue in its ngOnDestroy and I can't use its ChangeDetectorRef at that point. I assumed MatDialogContainer wasn't public API and that this would be okay.

Edit: I saw there was a golden failure for public API change so I updated the ChangeDetectorRef to be @internal.

atscott avatar Dec 26 '23 18:12 atscott

caretaker note: I'm not sure how merging is handled when changes affect the legacy components internally. This change will require deleting the _changeDetectorRef from the MatLegacyDialogContainer since it's now in the base class and protected

atscott avatar Dec 28 '23 15:12 atscott

Green TGP with local change mentioned above (remove _changeDetectorRef from constructor of ...legacy-dialog/dialog-container.ts)

atscott avatar Dec 28 '23 22:12 atscott

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.