Skip to content

Commit

Permalink
fix double submit routing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosmiceli committed Oct 3, 2024
1 parent 36b4cbf commit 1da543a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libs/Navigation/AppNavigator/AuthScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie

let signupQualifier;
if (currentUrl.includes('signupQualifier')) {
signupQualifier = currentUrl.split('signupQualifier=')[1].split('&')[0];
signupQualifier = new URL(currentUrl).searchParams.get('signupQualifier')
}
if (signupQualifier) {
if (signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.INDIVIDUAL) {
Expand Down
16 changes: 16 additions & 0 deletions src/libs/actions/Welcome/OnboardingFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import NAVIGATORS from '@src/NAVIGATORS';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
import Onboarding from '@src/types/onyx/Onboarding';

let selectedPurpose: string | undefined = '';
Onyx.connect({
Expand All @@ -31,6 +32,16 @@ const onboardingLastVisitedPathConnection = Onyx.connect({
},
});

let onboardingValues: Onboarding;
Onyx.connect({
key: ONYXKEYS.NVP_ONBOARDING,
callback: (value) => {
if (value !== undefined) {
onboardingValues = value as Onboarding;
}
},
});

/**
* Build the correct stack order for `onboardingModalNavigator`,
* based on onboarding data (currently from the selected purpose).
Expand Down Expand Up @@ -103,6 +114,11 @@ function startOnboardingFlow() {

function getOnboardingInitialPath(): string {
const state = getStateFromPath(onboardingInitialPath, linkingConfig.config);
const showBusinessModal = onboardingValues && 'signupQualifier' in onboardingValues && onboardingValues.signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.VSB;

if (showBusinessModal) {
return `/${ROUTES.ONBOARDING_WORK.route}`;
}
if (state?.routes?.at(-1)?.name !== NAVIGATORS.ONBOARDING_MODAL_NAVIGATOR) {
return `/${ROUTES.ONBOARDING_ROOT.route}`;
}
Expand Down

0 comments on commit 1da543a

Please sign in to comment.