The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Keep the workspace navigation section visible when it has no items (#25597)
Weiko61ae7a9fc58c
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/WorkspaceSectionContainer.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/WorkspaceSectionContainer.tsxindex bd25a0e73e0..69390a48373 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/WorkspaceSectionContainer.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/WorkspaceSectionContainer.tsx@@ -118,10 +118,6 @@ export const WorkspaceSectionContainer = ({};};- if (flatItems.length === 0 && !isAddToNavigationDropTargetVisible) {- return null;- }-return (<NavigationMenuItemSectiontitle={sectionTitle}diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/__tests__/WorkspaceSectionContainer.test.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/__tests__/WorkspaceSectionContainer.test.tsxnew file mode 100644index 00000000000..f7cf0198e1b--- /dev/null+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/workspace/components/__tests__/WorkspaceSectionContainer.test.tsx@@ -0,0 +1,34 @@+import { render, screen } from '@testing-library/react';+import { type ReactNode } from 'react';+import { MemoryRouter } from 'react-router-dom';++import { WorkspaceSectionContainer } from '@/navigation-menu-item/display/sections/workspace/components/WorkspaceSectionContainer';+import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';++const BaseWrapper = getJestMetadataAndApolloMocksWrapper({ apolloMocks: [] });++const Wrapper = ({ children }: { children: ReactNode }) => (+ <BaseWrapper>+ <MemoryRouter initialEntries={['/objects/companies']}>+ {children}+ </MemoryRouter>+ </BaseWrapper>+);++describe('WorkspaceSectionContainer', () => {+ it('keeps the section and its right icon reachable when there are no items', () => {+ render(+ <WorkspaceSectionContainer+ sectionTitle="Workspace"+ items={[]}+ rightIcon={<button type="button">Customize</button>}+ />,+ { wrapper: Wrapper },+ );++ expect(screen.getByText('Workspace')).toBeInTheDocument();+ expect(+ screen.getByRole('button', { name: 'Customize' }),+ ).toBeInTheDocument();+ });+});