From 472c7c1edc7dca4bfe50174dc3400f1d0c8afe4e Mon Sep 17 00:00:00 2001 From: eeshsaxena <139802361+eeshsaxena@users.noreply.github.com> Date: Sun, 26 Jul 2026 15:54:07 +0530 Subject: [PATCH] fix(workspace): open edit panel for PAGE_LAYOUT sidebar items (#23293) Fixes #22649. Custom page-layout links in the sidebar (like "Star History") couldn't be removed. Clicking them in edit mode did nothing. **Root cause** `handleNavigationMenuItemClick` in `WorkspaceSection.tsx` switches on `item.type`. `FOLDER` and `LINK` have explicit cases that call `openNavigationMenuItemInSidePanel`. `PAGE_LAYOUT` fell through to `default`, which calls `openViewOrRecordEditPanelAndNavigate`. That function only opens the side panel when `objectMetadataItem` is defined - PAGE_LAYOUT items don't have one - so the panel never opened. **Fix** Add a `PAGE_LAYOUT` case that calls `openNavigationMenuItemInSidePanel` directly, using the item's own label and icon. Same pattern as `LINK`. **How to test** 1. Create a custom page link in the sidebar (Settings > Workspace > Add menu item > Page layout). 2. Click the wrench icon to enter edit mode. 3. Click the custom page item - the edit side panel should now open. 4. Verify you can remove it from the sidebar. Review in cubic --------- Co-authored-by: prastoin --- .../sections/workspace/components/WorkspaceSection.tsx | 8 ++++++++ .../hooks/useSelectedNavigationMenuItemEditItemLabel.ts | 2 ++ 2 files changed, 10 insertions(+) diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/WorkspaceSection.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/WorkspaceSection.tsx index 5a2f6dfc05..ef885a3617 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/WorkspaceSection.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/WorkspaceSection.tsx @@ -152,6 +152,14 @@ export const WorkspaceSection = () => { pageIcon: IconLink, }); break; + case NavigationMenuItemType.PAGE_LAYOUT: + openNavigationMenuItemInSidePanel({ + pageTitle: + getNavigationMenuItemLabel(item, objectMetadataItems, views) || + t`Edit page`, + pageIcon: getIcon(item.icon), + }); + break; default: openViewOrRecordEditPanelAndNavigate(item, objectMetadataItem); } diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/hooks/useSelectedNavigationMenuItemEditItemLabel.ts b/packages/twenty-front/src/modules/navigation-menu-item/edit/hooks/useSelectedNavigationMenuItemEditItemLabel.ts index 3b839ac611..50bc84891f 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/edit/hooks/useSelectedNavigationMenuItemEditItemLabel.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/hooks/useSelectedNavigationMenuItemEditItemLabel.ts @@ -19,6 +19,8 @@ const getLabelForItem = ( return item.name ?? 'Folder'; case NavigationMenuItemType.LINK: return item.name ?? 'Link'; + case NavigationMenuItemType.PAGE_LAYOUT: + return item.name ?? 'Page'; case NavigationMenuItemType.OBJECT: case NavigationMenuItemType.VIEW: return (