gridstack-angular icon indicating copy to clipboard operation
gridstack-angular copied to clipboard

Perf: Potential source of jank.

Open BleuShan opened this issue 8 years ago • 0 comments

While looking at the source, I've stumbled upon those lines three lines:

https://github.com/kdietrich/gridstack-angular/blob/a2bccee4321ab700e4ed78162346886442643a76/src/gridstack.directive.js#L26-L27

https://github.com/kdietrich/gridstack-angular/blob/a2bccee4321ab700e4ed78162346886442643a76/src/gridstack.directive.js#L37-L38

https://github.com/kdietrich/gridstack-angular/blob/a2bccee4321ab700e4ed78162346886442643a76/src/gridstack.directive.js#L48-L49

Given that $timeout, when it resolves, calls $rootScope#$apply, it is somewhat redundant to call $scope.$apply within a $timeout callback. In some context its a potential source of jank because you might be forcing angular to re-digest the whole DOM.

You might consider removing those three lines or replacing $timeout with setTimeout. I did some testing and had some UI responsiveness issues when resizing some grid items which was alleviated with the removal.

BleuShan avatar Nov 29 '17 22:11 BleuShan