Skip to content

Commit

Permalink
fix: disable list view updates during bulk approval
Browse files Browse the repository at this point in the history
Also defer document refreshes by up to 5 seconds.

Rarely anyone needs truly realtime list view updates. It's better batch
them over at least 5 or so seconds if there's a high volume of changes.
  • Loading branch information
ankush committed Jul 19, 2023
1 parent 892c5e3 commit 06a905f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions frappe/public/js/frappe/list/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
this.workflow_action_items = {};

const actions = this.actions_menu_items.concat(this.workflow_action_menu_items);
actions.map((item) => {
actions.forEach((item) => {
const $item = this.page.add_actions_menu_item(item.label, item.action, item.standard);
if (item.class) {
$item.addClass(item.class);
Expand Down Expand Up @@ -1669,18 +1669,25 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {

get_workflow_action_menu_items() {
const workflow_actions = [];
const me = this;

if (frappe.model.has_workflow(this.doctype)) {
const actions = frappe.workflow.get_all_transition_actions(this.doctype);
actions.forEach((action) => {
workflow_actions.push({
label: __(action),
name: action,
action: () => {
frappe.xcall("frappe.model.workflow.bulk_workflow_approval", {
docnames: this.get_checked_items(true),
doctype: this.doctype,
action: action,
});
me.disable_list_update = true;
frappe
.xcall("frappe.model.workflow.bulk_workflow_approval", {
docnames: this.get_checked_items(true),
doctype: this.doctype,
action: action,
})
.finally(() => {
me.disable_list_update = false;
});
},
is_workflow_action: true,
});
Expand Down

0 comments on commit 06a905f

Please sign in to comment.