diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx index a5ac88220..2e03852c5 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx @@ -36,18 +36,6 @@ export const CommandMenu = () => { commandMenuSearch, }); - const selectableItems: Command[] = copilotCommands - .concat( - matchingStandardActionRecordSelectionCommands, - matchingStandardActionObjectCommands, - matchingWorkflowRunRecordSelectionCommands, - matchingStandardActionGlobalCommands, - matchingWorkflowRunGlobalCommands, - matchingNavigateCommands, - fallbackCommands, - ) - .filter(isDefined); - const previousContextStoreCurrentObjectMetadataItem = useRecoilComponentValueV2( contextStoreCurrentObjectMetadataItemComponentState, @@ -58,12 +46,6 @@ export const CommandMenu = () => { contextStoreCurrentObjectMetadataItemComponentState, ); - const selectableItemIds = selectableItems.map((item) => item.id); - - if (isDefined(previousContextStoreCurrentObjectMetadataItem)) { - selectableItemIds.unshift(RESET_CONTEXT_TO_SELECTION); - } - const commandGroups: CommandGroupConfig[] = [ { heading: t`Copilot`, @@ -91,6 +73,16 @@ export const CommandMenu = () => { }, ]; + const selectableItems: Command[] = commandGroups.flatMap( + (group) => group.items ?? [], + ); + + const selectableItemIds = selectableItems.map((item) => item.id); + + if (isDefined(previousContextStoreCurrentObjectMetadataItem)) { + selectableItemIds.unshift(RESET_CONTEXT_TO_SELECTION); + } + return (