1- import React , { useCallback , useContext , useEffect , useMemo , useState } from 'react' ;
1+ import React , { useCallback , useContext , useEffect , useMemo , useRef , useState } from 'react' ;
22import { InteractionManager , View } from 'react-native' ;
33import Button from '@components/Button' ;
44import 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