Throttling session calls due to performance issues

This commit is contained in:
Bruno Alves de Faria 2016-08-20 11:24:27 -03:00
parent 8832f101ad
commit 3732d7cf70

View File

@ -15,16 +15,15 @@ LayoutManager = class LayoutManager {
this.viewportData = [];
this.isZoomed = false;
const updateSessionFn = () => Tracker.afterFlush(() => Session.set('LayoutManagerUpdated', Random.id()));
this.updateSession = _.throttle(updateSessionFn, 300);
}
getNumberOfViewports() {
return this.layoutProps.rows * this.layoutProps.columns;
}
updateSession() {
Tracker.afterFlush(() => Session.set('LayoutManagerUpdated', Random.id()));
}
setDefaultViewportData() {
var numViewports = this.getNumberOfViewports();
@ -216,7 +215,7 @@ LayoutManager = class LayoutManager {
// Don't enlarge the viewport if we only have one Viewport
// to begin with
if (this.getNumberOfViewports() > 1) {
this.enlargeViewport(viewportIndex);
this.enlargeViewport(viewportIndex);
}
}
}