Throttling session calls due to performance issues
This commit is contained in:
parent
8832f101ad
commit
3732d7cf70
@ -15,16 +15,15 @@ LayoutManager = class LayoutManager {
|
|||||||
this.viewportData = [];
|
this.viewportData = [];
|
||||||
|
|
||||||
this.isZoomed = false;
|
this.isZoomed = false;
|
||||||
|
|
||||||
|
const updateSessionFn = () => Tracker.afterFlush(() => Session.set('LayoutManagerUpdated', Random.id()));
|
||||||
|
this.updateSession = _.throttle(updateSessionFn, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
getNumberOfViewports() {
|
getNumberOfViewports() {
|
||||||
return this.layoutProps.rows * this.layoutProps.columns;
|
return this.layoutProps.rows * this.layoutProps.columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSession() {
|
|
||||||
Tracker.afterFlush(() => Session.set('LayoutManagerUpdated', Random.id()));
|
|
||||||
}
|
|
||||||
|
|
||||||
setDefaultViewportData() {
|
setDefaultViewportData() {
|
||||||
var numViewports = this.getNumberOfViewports();
|
var numViewports = this.getNumberOfViewports();
|
||||||
|
|
||||||
@ -216,7 +215,7 @@ LayoutManager = class LayoutManager {
|
|||||||
// Don't enlarge the viewport if we only have one Viewport
|
// Don't enlarge the viewport if we only have one Viewport
|
||||||
// to begin with
|
// to begin with
|
||||||
if (this.getNumberOfViewports() > 1) {
|
if (this.getNumberOfViewports() > 1) {
|
||||||
this.enlargeViewport(viewportIndex);
|
this.enlargeViewport(viewportIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user