From 83f28f113a3e3c71a1d456a08439b3787b7217e2 Mon Sep 17 00:00:00 2001 From: Etienne <45695613+etiennejouan@users.noreply.github.com> Date: Wed, 18 Jun 2025 11:56:34 +0200 Subject: [PATCH] Onboarding - fix infinite loop (#12694) To reproduce : - IS_BILLING_ENABLED=true - Start creating a workspace. At each onboarding step - Create Profile / SyncEmails / InviteTeam - suspend your workspace > infinite loop closes https://github.com/twentyhq/twenty/issues/12272 --- .../usePageChangeEffectNavigateLocation.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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 (