Hi, I am trying to use the new sidebar feature with a custom app.
I created a new app, a new module, and a workspace inside that app.
Now, I am facing some issues with the sidebar UI:
When I click on the app, the URL navigates to the one defined in hooks.py, but not on the first click.
When I open a Doctype under that app, the sidebar becomes blank.
Here is a short gif illustrating the issue:
Console Error:
I noticed the following error in the console:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'workspaces')
at Sidebar.make_sidebar (desk.bundle.V6ESJGGS.js:sourcemap:18433:85)
at AppsSwitcher.set_current_app (desk.bundle.V6ESJGGS.js:sourcemap:18768:26)
at Workspace.show_page (desk.bundle.V6ESJGGS.js:sourcemap:41105:42)Understand this errorAI
desk.bundle.V6ESJGGS.js:sourcemap:18433
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'workspaces')
at Sidebar.make_sidebar (desk.bundle.V6ESJGGS.js:sourcemap:18433:85)
at AppsSwitcher.set_current_app (desk.bundle.V6ESJGGS.js:sourcemap:18768:26)
at Object.update (desk.bundle.V6ESJGGS.js:sourcemap:31226:42)
at Object.add (desk.bundle.V6ESJGGS.js:sourcemap:31198:12)
at form.js:593:23
I performed a simple test in the console and found that the workspaces object is missing in the boot info.
Iām working on a custom app and running into a similar issue with the sidebar. Iāve set up an app, module, and workspace, but sometimes the app doesnāt load properly on the first click. Also, when I open a Doctype, the sidebar turns blank.
Iām still learning Frappe, so Iām not sure if Iāve missed something during the setup. Did you manage to find a solution for this?
Hi, I encountered the same issue. The problem was caused by the app name being case-sensitive in frappe.boot.app_data_map, while frappe.current_app returns the app name in lowercase.
To fix this, I modified the sidebar.js file in the Frappe source code.
Here was the original line:
let app_workspaces = frappe.boot.app_data_map[frappe.current_app || āfrappeā].workspaces;
I replaced it with the following logic to ensure the correct casing:
let current_app_key = frappe.current_app || āfrappeā;
if (current_app_key.toLowerCase() === āpromotion_immoā) {
current_app_key = āPromotion_immoā; // Enforce correct capitalization
}
let app_workspaces = frappe.boot.app_data_map[current_app_key].workspaces;
In the browser console, when I checked frappe.boot.app_data_map, I noticed that the key was "Promotion_immo" (with an uppercase āPā), but the original code attempted to access it using "promotion_immo", which resulted in undefined. This patch ensures the correct key is used.