Skip to content

The open alternative to Salesforce, designed for AI.

Do not display back button at the root level of the command menu (#10073)

Raphaël Bosi08b8a0cc60a8
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx
index 0eb0598a535..4d1355657fa 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx
@@ -126,13 +126,15 @@ export const CommandMenuTopBar = () => {
<StyledContentContainer>
{isCommandMenuV2Enabled && (
<>
- <CommandMenuContextChip
- Icons={[<IconChevronLeft size={theme.icon.size.sm} />]}
- onClick={() => {
- goBackFromCommandMenu();
- }}
- testId="command-menu-go-back-button"
- />
+ {commandMenuPage !== CommandMenuPages.Root && (
+ <CommandMenuContextChip
+ Icons={[<IconChevronLeft size={theme.icon.size.sm} />]}
+ onClick={() => {
+ goBackFromCommandMenu();
+ }}
+ testId="command-menu-go-back-button"
+ />
+ )}
{isDefined(contextStoreCurrentObjectMetadataId) &&
commandMenuPage !== CommandMenuPages.SearchRecords ? (
<CommandMenuContextChipGroupsWithRecordSelection
diff --git a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx
index 8e6c054ae9c..417435f23ec 100644
--- a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx
@@ -197,17 +197,6 @@ export const NoResultsSearchFallback: Story = {
},
};
-export const GoBack: Story = {
- play: async () => {
- const canvas = within(document.body);
- const goBackButton = await canvas.findByTestId(
- 'command-menu-go-back-button',
- );
- await userEvent.click(goBackButton);
- await expect(goBackButton).not.toBeVisible();
- },
-};
-
export const ClickOnSearchRecordsAndGoBack: Story = {
play: async () => {
const canvas = within(document.body);