diff --git a/package.json b/package.json index 0731cd45597b..b36a278a4b2b 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand", "perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure", "typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc", - "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=229 --cache --cache-location=node_modules/.cache/eslint", + "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=228 --cache --cache-location=node_modules/.cache/eslint", "lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh", "lint-watch": "npx eslint-watch --watch --changed", "shellcheck": "./scripts/shellCheck.sh", diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 4023c7cce481..0a7cbb983ad3 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -120,7 +120,6 @@ function initializePusher() { } let timezone: Timezone | null; let currentAccountID = -1; -let isLoadingApp = false; let lastUpdateIDAppliedToClient: OnyxEntry; Onyx.connect({ @@ -163,13 +162,6 @@ Onyx.connect({ }, }); -Onyx.connect({ - key: ONYXKEYS.IS_LOADING_APP, - callback: (value) => { - isLoadingApp = !!value; - }, -}); - Onyx.connect({ key: ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT, callback: (value) => { @@ -177,7 +169,7 @@ Onyx.connect({ }, }); -function handleNetworkReconnect() { +function handleNetworkReconnect(isLoadingApp: boolean) { if (isLoadingApp) { App.openApp(); } else { @@ -229,6 +221,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie const {shouldUseNarrowLayout} = useResponsiveLayout(); const rootNavigatorScreenOptions = useRootNavigatorScreenOptions(); const currentUserPersonalDetails = useCurrentUserPersonalDetails(); + const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: true}); const {toggleSearch} = useSearchRouterContext(); const currentUrl = getCurrentUrl(); const delegatorEmail = getSearchParamFromUrl(currentUrl, 'delegatorEmail'); @@ -301,7 +294,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie } NetworkConnection.listenForReconnect(); - NetworkConnection.onReconnect(handleNetworkReconnect); + NetworkConnection.onReconnect(() => handleNetworkReconnect(!!isLoadingApp)); PusherConnectionManager.init(); initializePusher(); // Sometimes when we transition from old dot to new dot, the client is not the leader