Improve event bindings on OverlayPanel and ContextMenu to avoid unnecessary change detection #3671
Labels
Type: Enhancement
Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
Please fork the plunkr below and create a case demonstrating your bug report. Issues without a plunkr have much less possibility to be reviewed.
http://plnkr.co/edit/pIKtgnZXEYNQA4cJed7k?p=preview
Current behavior
Every overlayPanel and contextMenu seems to trigger the change detection on every click in the page, even if they are not visible.
Expected behavior
The change detection should be triggered just one time for all (and maybe just if at least one is visible)
Minimal reproduction of the problem with instructions
see the plunker, it just has 3 overlaypanel and 2 contextMenu and a change detection counter. Click wherever in the page and you'll see the counter going up by five.
What is the motivation / use case for changing the behavior?
when combining multiple components that use an overlayPanel or a contextMenu, every click cause multiple change detections, causing lag when there are about 10/15 of them.
Angular version: 4.3.4
PrimeNG version: 4.1.2
Browser: Chrome 60
Language: TypeScript 2.4.2
The text was updated successfully, but these errors were encountered: