Skip to content

The open alternative to Salesforce, designed for AI.

Fix main's red typecheck: drop removed portal fields from the settings test wrapper (#25196)

Félix Malfait61ee35e393e1
diff --git a/packages/twenty-front/src/hooks/__tests__/useNavigateSettings.test.tsx b/packages/twenty-front/src/hooks/__tests__/useNavigateSettings.test.tsx
index 4109a734ac5..92e78716f6a 100644
--- a/packages/twenty-front/src/hooks/__tests__/useNavigateSettings.test.tsx
+++ b/packages/twenty-front/src/hooks/__tests__/useNavigateSettings.test.tsx
@@ -45,8 +45,6 @@ const RoutedSidePanelWrapper = ({
type: 'side-panel',
instanceId: 'side-panel-page',
ownsRouteLocation: true,
- headerTitlePortal: null,
- headerActionsPortal: null,
}}
>
{children}
@@ -140,4 +138,34 @@ describe('useNavigateSettings', () => {
undefined,
);
});
+
+ it('opens settings when a legacy side-panel page escapes to main', () => {
+ const { result } = renderHook(() => useNavigateSettings(), {
+ wrapper: SidePanelWrapper,
+ });
+
+ result.current(SettingsPath.NewAccount, undefined, undefined, {
+ surface: 'main',
+ });
+
+ expect(openSettingsMenuMock).toHaveBeenCalledTimes(1);
+ expect(mockNavigate).toHaveBeenCalledWith('/settings/accounts/new', {
+ surface: 'main',
+ });
+ });
+
+ it('leaves the shell to the navigator when a routed page escapes to main', () => {
+ const { result } = renderHook(() => useNavigateSettings(), {
+ wrapper: RoutedSidePanelWrapper,
+ });
+
+ result.current(SettingsPath.NewAccount, undefined, undefined, {
+ surface: 'main',
+ });
+
+ expect(openSettingsMenuMock).not.toHaveBeenCalled();
+ expect(mockNavigate).toHaveBeenCalledWith('/settings/accounts/new', {
+ surface: 'main',
+ });
+ });
});
diff --git a/packages/twenty-front/src/hooks/useNavigateSettings.ts b/packages/twenty-front/src/hooks/useNavigateSettings.ts
index 3f05b927a3b..d129cd80f8f 100644
--- a/packages/twenty-front/src/hooks/useNavigateSettings.ts
+++ b/packages/twenty-front/src/hooks/useNavigateSettings.ts
@@ -24,6 +24,9 @@ export const useNavigateSettings = () => {
) => {
const path = getSettingsPath(to, params, queryParams, hash);
+ // A routed side-panel owns its location, and its navigator already opens
+ // the settings shell when a path escapes to main. Every other surface
+ // navigates the main router directly, so the shell has to be opened here.
if (
workspaceSurface.type === 'main' ||
!workspaceSurface.ownsRouteLocation