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
This commit is contained in:
@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user