fix(material/select): run viewportRuler change event outside the zone
MatSelect component was listening viewportRuler change event inside the zone. Due to this, a CD cycle was fired after every 'resize' event, event there was nothing to detect changes. It only make sense to run a CD cycle if the mat-select panel is open.
Fixes #18546
I think this should resolve it for all components, not just mat-select: https://github.com/angular/components/pull/15814.
It makes sense (I didn't see this issue.).
About this MR #15814 where is handled globally, I miss a re-zone entering in case the mat-select has the panel open.
I mean this particular code (from my MR):
if (this._panelOpen) {
this._ngZone.run(() => {
this._triggerRect = this.trigger.nativeElement.getBoundingClientRect();
this._changeDetectorRef.markForCheck();
})
}
Sure, that makes sense, but the outer one should still be removed.