Skip to content

Commit 567526e

Browse files
committed
fix: delay transition to OD after onboarding
1 parent 4b68aa8 commit 567526e

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
@@ -4209,19 +4209,19 @@ function completeOnboarding({
42094209
optimisticData.push({
42104210
onyxMethod: Onyx.METHOD.MERGE,
42114211
key: ONYXKEYS.NVP_ONBOARDING,
4212-
value: {isLoading: true},
4212+
value: {isLoading: true, hasCompletedGuidedSetupFlow: false},
42134213
});
42144214

42154215
successData.push({
42164216
onyxMethod: Onyx.METHOD.MERGE,
42174217
key: ONYXKEYS.NVP_ONBOARDING,
4218-
value: {isLoading: false},
4218+
value: {isLoading: false, hasCompletedGuidedSetupFlow: true},
42194219
});
42204220

42214221
failureData.push({
42224222
onyxMethod: Onyx.METHOD.MERGE,
42234223
key: ONYXKEYS.NVP_ONBOARDING,
4224-
value: {isLoading: false},
4224+
value: {isLoading: false, hasCompletedGuidedSetupFlow: false},
42254225
});
42264226
}
42274227

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]);
@@ -204,10 +206,12 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
204206
});
205207

206208
if (shouldOnboardingRedirectToOldDot(onboardingCompanySize, newUserReportedIntegration)) {
207-
if (CONFIG.IS_HYBRID_APP) {
209+
if (CONFIG.IS_HYBRID_APP || didOpenOldDotLink.current) {
208210
return;
209211
}
212+
didOpenOldDotLink.current = true;
210213
openOldDotLink(CONST.OLDDOT_URLS.INBOX, true);
214+
return;
211215
}
212216

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

0 commit comments

Comments
 (0)