diff --git a/packages/admin/dashboard/src/components/layout/nav-item/nav-item.tsx b/packages/admin/dashboard/src/components/layout/nav-item/nav-item.tsx index 41d492ddba..562ff1be3c 100644 --- a/packages/admin/dashboard/src/components/layout/nav-item/nav-item.tsx +++ b/packages/admin/dashboard/src/components/layout/nav-item/nav-item.tsx @@ -122,6 +122,7 @@ export const NavItem = ({ clx( navLinkClassNames({ @@ -189,6 +191,7 @@ export const NavItem = ({ clx( navLinkClassNames({ diff --git a/packages/admin/dashboard/src/extensions/dashboard-extension-manager/dashboard-extension-manager.tsx b/packages/admin/dashboard/src/extensions/dashboard-extension-manager/dashboard-extension-manager.tsx index da8af22e2a..29cb13f254 100644 --- a/packages/admin/dashboard/src/extensions/dashboard-extension-manager/dashboard-extension-manager.tsx +++ b/packages/admin/dashboard/src/extensions/dashboard-extension-manager/dashboard-extension-manager.tsx @@ -90,7 +90,7 @@ export class DashboardExtensionManager { if (item.path.includes("/:")) { if (process.env.NODE_ENV === "development") { console.warn( - `Menu item for path "${item.path}" can't be added to the sidebar as it contains a parameter.` + `[@medusajs/dashboard] Menu item for path "${item.path}" can't be added to the sidebar as it contains a parameter.` ) } return @@ -99,6 +99,19 @@ export class DashboardExtensionManager { const isSettingsPath = item.path.startsWith("/settings") const key = isSettingsPath ? "settingsExtensions" : "coreExtensions" + const pathParts = item.path.split("/").filter(Boolean) + const parentPath = "/" + pathParts.slice(0, -1).join("/") + + // Check if this is a nested settings path + if (isSettingsPath && pathParts.length > 2) { + if (process.env.NODE_ENV === "development") { + console.warn( + `[@medusajs/dashboard] Nested settings menu item "${item.path}" can't be added to the sidebar. Only top-level settings items are allowed.` + ) + } + return // Skip this item entirely + } + const navItem: INavItem = { label: item.label, to: item.path, @@ -106,9 +119,6 @@ export class DashboardExtensionManager { items: [], } - const pathParts = item.path.split("/").filter(Boolean) - const parentPath = "/" + pathParts.slice(0, -1).join("/") - if (parentPath !== "/" && tempRegistry[parentPath]) { if (!tempRegistry[parentPath].items) { tempRegistry[parentPath].items = []