diff --git a/src/hooks/useOnboardingFlow.ts b/src/hooks/useOnboardingFlow.ts index b71795f32881..08a9c6a9555f 100644 --- a/src/hooks/useOnboardingFlow.ts +++ b/src/hooks/useOnboardingFlow.ts @@ -55,7 +55,7 @@ function useOnboardingFlowRouter() { useEffect(() => { // This should delay opening the onboarding modal so it does not interfere with the ongoing ReportScreen params changes // eslint-disable-next-line @typescript-eslint/no-deprecated - InteractionManager.runAfterInteractions(() => { + const handle = InteractionManager.runAfterInteractions(() => { // Prevent starting the onboarding flow if we are logging in as a new user with short lived token if (currentUrl?.includes(ROUTES.TRANSITION_BETWEEN_APPS) && isLoggingInAsNewSessionUser) { return; @@ -146,6 +146,10 @@ function useOnboardingFlowRouter() { }); } }); + + return () => { + handle.cancel(); + }; }, [ isLoadingApp, isHybridAppOnboardingCompleted,