From 224a06eef7890b0eb4e6d3dede7708d446b66d14 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 22 Aug 2017 12:51:14 +0530 Subject: [PATCH] [fix] throttle running multiple times (#3962) * [fix] throttle running multiple times * [fix] lint --- frappe/public/js/frappe/views/reports/query_report.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frappe/public/js/frappe/views/reports/query_report.js b/frappe/public/js/frappe/views/reports/query_report.js index 7e0bc14a13..ceb0a696bb 100644 --- a/frappe/public/js/frappe/views/reports/query_report.js +++ b/frappe/public/js/frappe/views/reports/query_report.js @@ -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;