SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 295 forks source link

Bugfix/debounce window resize #1303

Closed adamdport closed 8 years ago

kfranqueiro commented 8 years ago

What is this intended to "fix"? Throttling was performed intentionally rather than debouncing so that the grid will still appear responsive as a user resizes the window, but require less frequent overhead. Switching to debounce could potentially cause the grid to look unresponsive while the user is resizing.

adamdport commented 8 years ago

In cases where a large number of grids are used (50+ in our case), resizing can cause browsers to become unresponsive. The current implementation of "throttle" is actually permitting resize calculations once per grid every 15ms. Calculating dimensions on all our grids generally takes longer than 15ms, and resize calls end up stacking. We ultimately end up with an unresponsive browser while it finishes several hundred resize calculations. After changing orientation to landscape and back quickly in iOS, we need to wait upwards of 10 seconds for the browser to finish.

I have tested debounce and confirm that it resolves performance issues in the project I'm working on.

I agree that debounce would prevent the grid from recalculating while resizing, but if they stop resizing for a fifth of a second, they will see a resize. IMHO that seems like acceptable UX.

edhager commented 8 years ago

@msssk added a configurable window resize throttle in #1306.