Skip to content

Commit 0619df2

Browse files
committed
Navigate to Personal details if not provided initially
1 parent 18d4f1e commit 0619df2

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ function BaseOnboardingAccounting({shouldUseNativeStyles, route}: BaseOnboarding
103103
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false});
104104
const [onboardingCompanySize] = useOnyx(ONYXKEYS.ONBOARDING_COMPANY_SIZE, {canBeMissing: true});
105105
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
106+
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true});
106107

107108
const [onboardingUserReportedIntegration] = useOnyx(ONYXKEYS.ONBOARDING_USER_REPORTED_INTEGRATION, {canBeMissing: true});
109+
const isPrivateDomainAndHasAccessiblePolicies = !account?.isFromPublicDomain && !!account?.hasAccessibleDomainPolicies;
108110

109111
const [userReportedIntegration, setUserReportedIntegration] = useState<OnboardingAccounting | undefined>(onboardingUserReportedIntegration ?? undefined);
110112
const [error, setError] = useState('');
@@ -195,10 +197,12 @@ function BaseOnboardingAccounting({shouldUseNativeStyles, route}: BaseOnboarding
195197
}
196198

197199
setOnboardingUserReportedIntegration(userReportedIntegration);
198-
199-
// Navigate to the next onboarding step with the selected integration
200-
Navigation.navigate(ROUTES.ONBOARDING_INTERESTED_FEATURES.getRoute(route.params?.backTo));
201-
}, [translate, userReportedIntegration, route.params?.backTo]);
200+
// Navigate to Interested Features if personal details have already been provided.
201+
const nextRoute = isPrivateDomainAndHasAccessiblePolicies
202+
? ROUTES.ONBOARDING_INTERESTED_FEATURES.getRoute(route.params?.backTo)
203+
: ROUTES.ONBOARDING_PERSONAL_DETAILS.getRoute(route.params?.backTo);
204+
Navigation.navigate(nextRoute);
205+
}, [translate, userReportedIntegration, route.params?.backTo, isPrivateDomainAndHasAccessiblePolicies]);
202206

203207
const handleIntegrationSelect = useCallback((integrationKey: OnboardingAccounting | null) => {
204208
setUserReportedIntegration(integrationKey);

0 commit comments

Comments
 (0)