Merge pull request #21252 from shariquerik/workspace-content-duplicating-fix

fix: avoid loading workspace content if already loaded
This commit is contained in:
Shariq Ansari 2023-06-06 09:11:53 +05:30 committed by GitHub
commit c515b29c5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View file

@ -6,16 +6,16 @@ frappe.listview_settings["DocType"] = {
setup_select_primary_button: function (me) {
let actions = [
{
label: __("Add DocType"),
description: __("Create a new DocType"),
action: () => frappe.new_doc("DocType"),
},
{
label: __("Add DocType (Form Builder)"),
description: __("Use the form builder to create a new DocType"),
action: () => frappe.set_route("form-builder", "new-doctype"),
},
{
label: __("Add DocType"),
description: __("Create a new DocType"),
action: () => frappe.new_doc("DocType"),
},
];
frappe.utils.add_select_group_button(

View file

@ -22,6 +22,7 @@ frappe.views.Workspace = class Workspace {
this.page = wrapper.page;
this.blocks = frappe.workspace_block.blocks;
this.is_read_only = true;
this.is_page_loaded = false;
this.pages = {};
this.sorted_public_items = [];
this.sorted_private_items = [];
@ -248,10 +249,14 @@ frappe.views.Workspace = class Workspace {
this.update_selected_sidebar(page, true); //add selected on new page
if (!frappe.router.current_route[0]) {
this.is_page_loaded = true;
frappe.set_route(frappe.router.slug(page.public ? page.name : "private/" + page.name));
}
this.show_page(page);
if (!this.is_page_loaded) {
this.show_page(page);
this.is_page_loaded = false;
}
}
update_selected_sidebar(page, add) {