blackbaud / skyux2

SKY UX 2 is the new version of Blackbaud’s user experience framework that implements Blackbaud design patterns. It extends the framework to abstract many complexities of modern web development and takes advantage of Angular 2 to increase the tooling, testing, and performance available.
https://developer.blackbaud.com/skyux
MIT License
32 stars 65 forks source link

SkyGridComponent causes change detection with every mouse movement #2216

Closed Blackbaud-AnandBhat closed 5 years ago

Blackbaud-AnandBhat commented 5 years ago

Expected behavior

Adding a SkyGridComponent to SKY UX 2 SPA should not trigger change detection with every mouse movement.

Actual behavior

Adding a SkyGridComponent to SKY UX 2 SPA causes change detection to be triggered with every mouse movement unnecessarily. This is due to a HostListener on the document:mousemove event. I believe that instead of using a HostListener, a listener for the mousemove event should only be added when the mousedown event is fired and removed when the mouseup event is fired.

Steps to reproduce

Plunker

Plunker created from the Grid demo and adding a log of every time ngAfterViewChecked is called: https://plnkr.co/edit/kbwHhgB9EsKM0ZgfhaYu?p=preview

Severity

Medium

Impact

Could potentially cause performance issues.

Blackbaud-AlexKingman commented 5 years ago

We might look at using Renderer2 to dynamically turn on/off listeners.