Skip to content

Commit

Permalink
fix: Hide Menu if empty & render columns without state change
Browse files Browse the repository at this point in the history
- 'Refresh' btn is always present in dropdown menu. Show menu if any other action is also present.
- Without `update_order` state is not changed, and thus columns are not rendered on `init()`
- If we are not updating order in the db, render columns with whatever information we have currently

(cherry picked from commit 5d0ad77)
  • Loading branch information
marination authored and mergify[bot] committed Mar 16, 2023
1 parent 9c87356 commit a9b5f04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frappe/public/js/frappe/views/kanban/kanban_board.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,11 @@ frappe.provide("frappe.views");
}, show_empty_state);

if (frappe.model.can_write(store.state.doctype)) {
// Check for reference doctype access before initiating
// non-deliberate action
// Check for reference doctype access before trying to modify it's value
store.dispatch("update_order");
} else {
// Render columns without state change
make_columns();
}
}

Expand Down
10 changes: 10 additions & 0 deletions frappe/public/js/frappe/views/kanban/kanban_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ frappe.views.KanbanView = class KanbanView extends frappe.views.ListView {
});
}

init() {
return super.init().then(() => {
let menu_length = this.page.menu.find(".dropdown-item").length;
if (menu_length === 1) {
// Only 'Refresh' (hidden) is present (always), dropdown is visibly empty
this.page.hide_menu();
}
});
}

setup_defaults() {
return super.setup_defaults().then(() => {
let get_board_name = () => {
Expand Down

0 comments on commit a9b5f04

Please sign in to comment.