[fix] throttle running multiple times (#3962)

* [fix] throttle running multiple times

* [fix] lint
This commit is contained in:
Rushabh Mehta 2017-08-22 12:51:14 +05:30 committed by Nabin Hait
parent 0f63f8a889
commit 224a06eef7

View file

@ -364,6 +364,16 @@ frappe.views.QueryReport = Class.extend({
}
},
refresh: function() {
// throttle
// stop refresh from being called multiple times (from triggers ?)
if (!this.request_refresh) {
this.request_refresh = setTimeout(() => {
this._refresh();
this.request_refresh = null;
}, 300);
}
},
_refresh: function() {
// Run
var me = this;