fix: actually debounce list view updates (#21738)

Immediately debouncing and executing creates a new function everytime and doesn't actually "debounce" it just "delays". 🗿

[skip ci]
This commit is contained in:
Ankush Menat 2023-07-19 20:42:43 +05:30 committed by GitHub
parent 453892cdef
commit c2a5adadbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,10 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
constructor(opts) { constructor(opts) {
super(opts); super(opts);
this.show(); this.show();
this.debounced_refresh = frappe.utils.debounce(
this.process_document_refreshes.bind(this),
2000
);
} }
has_permissions() { has_permissions() {
@ -1377,7 +1381,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
} }
this.pending_document_refreshes.push(data); this.pending_document_refreshes.push(data);
frappe.utils.debounce(this.process_document_refreshes.bind(this), 1000)(); this.debounced_refresh();
}); });
this.realtime_events_setup = true; this.realtime_events_setup = true;
} }