From 8e5d5869acb5d1ee7f2299a75fa8814cdbfba0d9 Mon Sep 17 00:00:00 2001 From: Vit Horacek <36083550+mountiny@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:24:06 +0100 Subject: [PATCH] Merge pull request #52793 from Expensify/revert-52694-loading-skeleton-when-notification-tapped-ND (cherry picked from commit b4830afb99cbf072deb2aaf4724d2762b9df654c) (CP triggered by mountiny) --- src/components/InitialURLContextProvider.tsx | 12 +++--------- src/libs/actions/Session/index.ts | 11 ++--------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/components/InitialURLContextProvider.tsx b/src/components/InitialURLContextProvider.tsx index 8042786ff8af..adf361a2573d 100644 --- a/src/components/InitialURLContextProvider.tsx +++ b/src/components/InitialURLContextProvider.tsx @@ -1,10 +1,8 @@ import React, {createContext, useEffect, useMemo, useState} from 'react'; import type {ReactNode} from 'react'; import {Linking} from 'react-native'; -import {useOnyx} from 'react-native-onyx'; import {signInAfterTransitionFromOldDot} from '@libs/actions/Session'; import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; import type {Route} from '@src/ROUTES'; import {useSplashScreenStateContext} from '@src/SplashScreenStateContext'; @@ -30,13 +28,10 @@ type InitialURLContextProviderProps = { function InitialURLContextProvider({children, url}: InitialURLContextProviderProps) { const [initialURL, setInitialURL] = useState(); const {setSplashScreenState} = useSplashScreenStateContext(); - const [initialLastUpdateIDAppliedToClient, metadata] = useOnyx(ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT); + useEffect(() => { - if (metadata.status !== 'loaded') { - return; - } if (url) { - signInAfterTransitionFromOldDot(url, initialLastUpdateIDAppliedToClient).then((route) => { + signInAfterTransitionFromOldDot(url).then((route) => { setInitialURL(route); setSplashScreenState(CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN); }); @@ -45,7 +40,7 @@ function InitialURLContextProvider({children, url}: InitialURLContextProviderPro Linking.getInitialURL().then((initURL) => { setInitialURL(initURL as Route); }); - }, [initialLastUpdateIDAppliedToClient, metadata.status, setSplashScreenState, url]); + }, [setSplashScreenState, url]); const initialUrlContext = useMemo( () => ({ @@ -61,5 +56,4 @@ function InitialURLContextProvider({children, url}: InitialURLContextProviderPro InitialURLContextProvider.displayName = 'InitialURLContextProvider'; export default InitialURLContextProvider; - export {InitialURLContext}; diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index bb5bca7374b7..af7da709d456 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -481,7 +481,7 @@ function signUpUser() { API.write(WRITE_COMMANDS.SIGN_UP_USER, params, {optimisticData, successData, failureData}); } -function signInAfterTransitionFromOldDot(transitionURL: string, lastUpdateId?: number) { +function signInAfterTransitionFromOldDot(transitionURL: string) { const [route, queryParams] = transitionURL.split('?'); const { @@ -528,14 +528,7 @@ function signInAfterTransitionFromOldDot(transitionURL: string, lastUpdateId?: n [ONYXKEYS.NVP_TRYNEWDOT]: {classicRedirect: {completedHybridAppOnboarding: completedHybridAppOnboarding === 'true'}}, }), ) - .then(() => { - if (clearOnyxOnStart === 'true') { - // We clear Onyx when this flag is set to true so we have to download all data - App.openApp(); - } else { - App.reconnectApp(lastUpdateId); - } - }) + .then(App.openApp) .catch((error) => { Log.hmmm('[HybridApp] Initialization of HybridApp has failed. Forcing transition', {error}); })