diff --git a/public/services/data-factory.js b/public/services/data-factory.js index 3ebcfc6b46..c4bc6b7c51 100644 --- a/public/services/data-factory.js +++ b/public/services/data-factory.js @@ -20,6 +20,7 @@ export class DataFactory { this.sortValue = false; this.sortDir = false; this.sortValue = false; + this.busy = false; if (this.implicitFilter) this.filters.push(...this.implicitFilter); } @@ -56,6 +57,8 @@ export class DataFactory { async fetch(options = {}) { try { + if(this.busy) return { items: this.items, time: 0 }; + this.busy = true; const start = new Date(); // If offset is not given, it means we need to start again @@ -89,9 +92,10 @@ export class DataFactory { const end = new Date(); const elapsed = (end - start) / 1000; - + this.busy = false; return { items: this.items, time: elapsed }; } catch (error) { + this.busy = false; return Promise.reject(error); } }