Skip to content

Commit 8aca992

Browse files
authored
Merge pull request Expensify#67209 from gijoe0295/gijoe/63628
fix: delay transition to OD after onboarding
2 parents fa3ba59 + 567526e commit 8aca992

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/libs/actions/Report.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4218,19 +4218,19 @@ function completeOnboarding({
42184218
optimisticData.push({
42194219
onyxMethod: Onyx.METHOD.MERGE,
42204220
key: ONYXKEYS.NVP_ONBOARDING,
4221-
value: {isLoading: true},
4221+
value: {isLoading: true, hasCompletedGuidedSetupFlow: false},
42224222
});
42234223

42244224
successData.push({
42254225
onyxMethod: Onyx.METHOD.MERGE,
42264226
key: ONYXKEYS.NVP_ONBOARDING,
4227-
value: {isLoading: false},
4227+
value: {isLoading: false, hasCompletedGuidedSetupFlow: true},
42284228
});
42294229

42304230
failureData.push({
42314231
onyxMethod: Onyx.METHOD.MERGE,
42324232
key: ONYXKEYS.NVP_ONBOARDING,
4233-
value: {isLoading: false},
4233+
value: {isLoading: false, hasCompletedGuidedSetupFlow: false},
42344234
});
42354235
}
42364236

src/pages/OnboardingInterestedFeatures/BaseOnboardingInterestedFeatures.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useCallback, useContext, useEffect, useMemo, useState} from 'react';
1+
import React, {useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
22
import {InteractionManager, View} from 'react-native';
33
import Button from '@components/Button';
44
import Checkbox from '@components/Checkbox';
@@ -64,6 +64,7 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
6464
const {isOffline} = useNetwork();
6565
const isLoading = onboarding?.isLoading;
6666
const prevIsLoading = usePrevious(isLoading);
67+
const didOpenOldDotLink = useRef(false);
6768

6869
const features: Feature[] = useMemo(() => {
6970
return [
@@ -148,7 +149,7 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
148149
}, [paidGroupPolicy, onboardingPolicyID]);
149150

150151
useEffect(() => {
151-
if (!!isLoading || !prevIsLoading) {
152+
if (!!isLoading || !prevIsLoading || didOpenOldDotLink.current) {
152153
return;
153154
}
154155

@@ -158,6 +159,7 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
158159
return;
159160
}
160161
waitForIdle().then(() => {
162+
didOpenOldDotLink.current = true;
161163
openOldDotLink(CONST.OLDDOT_URLS.INBOX, true);
162164
});
163165
}, [isLoading, prevIsLoading, setRootStatusBarEnabled]);
@@ -213,10 +215,12 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
213215
});
214216

215217
if (shouldOnboardingRedirectToOldDot(onboardingCompanySize, newUserReportedIntegration)) {
216-
if (CONFIG.IS_HYBRID_APP) {
218+
if (CONFIG.IS_HYBRID_APP || didOpenOldDotLink.current) {
217219
return;
218220
}
221+
didOpenOldDotLink.current = true;
219222
openOldDotLink(CONST.OLDDOT_URLS.INBOX, true);
223+
return;
220224
}
221225

222226
// Avoid creating new WS because onboardingPolicyID is cleared before unmounting

0 commit comments

Comments
 (0)