Skip to content

fix(material/select): run viewportRuler change event outside the zone #18548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

llorenspujol
Copy link
Contributor

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

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 19, 2020
@crisbeto
Copy link
Member

I think this should resolve it for all components, not just mat-select: #15814.

@llorenspujol
Copy link
Contributor Author

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();
    })
}

@crisbeto
Copy link
Member

Sure, that makes sense, but the outer one should still be removed.

@llorenspujol llorenspujol force-pushed the select-resize-outside-zone branch from b82b091 to 0cff534 Compare March 5, 2020 14:25
@llorenspujol llorenspujol force-pushed the select-resize-outside-zone branch 2 times, most recently from 4c6f48b to 6d45a7c Compare March 5, 2020 14:51
@llorenspujol llorenspujol force-pushed the select-resize-outside-zone branch from 6d45a7c to 1ddf8a0 Compare March 5, 2020 15:33
@andrewseguin andrewseguin removed the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 28, 2021
@josephperrott josephperrott added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed needs rebase labels Nov 16, 2022
@josephperrott josephperrott requested a review from a team as a code owner December 18, 2024 17:40
@mmalerba
Copy link
Contributor

Closing since this has been fixed by #15814

@mmalerba mmalerba closed this Jan 15, 2025
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mat-select listens window 'resize' event inside the zone
6 participants