Skip to content

Commit

Permalink
fix: Avoid list update if user is doing some bulk operation (backport f…
Browse files Browse the repository at this point in the history
…rappe#20432) (frappe#20444)

Co-authored-by: Shariq Ansari <sharique.rik@gmail.com>
  • Loading branch information
mergify[bot] and shariquerik committed Mar 23, 2023
1 parent defb02a commit 5248b74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 1 addition & 5 deletions cypress/integration/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ context('List View', () => {
method: 'POST',
url: 'api/method/frappe.model.workflow.bulk_workflow_approval'
}).as('bulk-approval');
cy.intercept({
method: 'POST',
url: 'api/method/frappe.desk.reportview.get'
}).as('real-time-update');
cy.wrap(elements).contains('Approve').click();
cy.wait(['@bulk-approval', '@real-time-update']);
cy.wait('@bulk-approval');
cy.wait(300);
cy.get_open_dialog().find('.btn-modal-close').click();
cy.reload();
Expand Down
6 changes: 6 additions & 0 deletions frappe/public/js/frappe/list/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,12 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
if (!data || (data.doctype !== this.doctype)) {
return;
}

// if some bulk operation is happening by selecting list items, don't refresh
if (this.$checks && this.$checks.length) {
return;
}

if (data.doctype && data.name) {
let doc = frappe.get_doc(data.doctype, data.name);
if (doc && doc.__unsaved) {
Expand Down

0 comments on commit 5248b74

Please sign in to comment.