diff --git a/packages/twenty-front/src/hooks/usePageChangeEffectNavigateLocation.ts b/packages/twenty-front/src/hooks/usePageChangeEffectNavigateLocation.ts index 90193a558..02c729c06 100644 --- a/packages/twenty-front/src/hooks/usePageChangeEffectNavigateLocation.ts +++ b/packages/twenty-front/src/hooks/usePageChangeEffectNavigateLocation.ts @@ -1,5 +1,6 @@ import { verifyEmailNextPathState } from '@/app/states/verifyEmailNextPathState'; import { useIsLogged } from '@/auth/hooks/useIsLogged'; +import { useIsCurrentLocationOnAWorkspace } from '@/domain-manager/hooks/useIsCurrentLocationOnAWorkspace'; import { useDefaultHomePagePath } from '@/navigation/hooks/useDefaultHomePagePath'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { useOnboardingStatus } from '@/onboarding/hooks/useOnboardingStatus'; @@ -12,7 +13,6 @@ import { isDefined } from 'twenty-shared/utils'; import { WorkspaceActivationStatus } from 'twenty-shared/workspace'; import { OnboardingStatus } from '~/generated/graphql'; import { isMatchingLocation } from '~/utils/isMatchingLocation'; -import { useIsCurrentLocationOnAWorkspace } from '@/domain-manager/hooks/useIsCurrentLocationOnAWorkspace'; export const usePageChangeEffectNavigateLocation = () => { const isLoggedIn = useIsLogged(); @@ -71,13 +71,14 @@ export const usePageChangeEffectNavigateLocation = () => { return AppPath.PlanRequired; } - if ( - isWorkspaceSuspended && - !isMatchingLocation(location, AppPath.SettingsCatchAll) - ) { - return `${AppPath.SettingsCatchAll.replace('/*', '')}/${ - SettingsPath.Billing - }`; + if (isWorkspaceSuspended) { + if (!isMatchingLocation(location, AppPath.SettingsCatchAll)) { + return `${AppPath.SettingsCatchAll.replace('/*', '')}/${ + SettingsPath.Billing + }`; + } + + return; } if (