fix(desk): Filter out other doctypes on list_update event

This commit is contained in:
Gavin D'souza 2023-02-01 17:05:01 +05:30
parent 419503ec06
commit ccb7c8cd80

View file

@ -1330,6 +1330,10 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
}
frappe.socketio.doctype_subscribe(this.doctype);
frappe.realtime.on("list_update", (data) => {
if (data?.doctype !== this.doctype) {
return;
}
if (!frappe.get_doc(data?.doctype, data?.name)?.__unsaved) {
frappe.model.remove_from_locals(data.doctype, data.name);
}
@ -1345,9 +1349,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
process_document_refreshes() {
if (!this.pending_document_refreshes.length) return;
const names = this.pending_document_refreshes
.filter((d) => d.doctype === this.doctype)
.map((d) => d.name);
const names = this.pending_document_refreshes.map((d) => d.name);
this.pending_document_refreshes = this.pending_document_refreshes.filter(
(d) => names.indexOf(d.name) === -1
);