diff --git a/src/hooks/usePrivatePersonalDetails.js b/src/hooks/usePrivatePersonalDetails.ts similarity index 63% rename from src/hooks/usePrivatePersonalDetails.js rename to src/hooks/usePrivatePersonalDetails.ts index 04d90f1ce5de..89d9951cef11 100644 --- a/src/hooks/usePrivatePersonalDetails.js +++ b/src/hooks/usePrivatePersonalDetails.ts @@ -1,5 +1,4 @@ import {useContext, useEffect} from 'react'; -import _ from 'underscore'; import {NetworkContext} from '@components/OnyxProvider'; import * as PersonalDetails from '@userActions/PersonalDetails'; @@ -7,13 +6,15 @@ import * as PersonalDetails from '@userActions/PersonalDetails'; * Hook for fetching private personal details */ export default function usePrivatePersonalDetails() { - const {isOffline} = useContext(NetworkContext); + const network = useContext(NetworkContext); useEffect(() => { const personalDetails = PersonalDetails.getPrivatePersonalDetails(); - if (isOffline || (Boolean(personalDetails) && !_.isUndefined(personalDetails.isLoading))) { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + if (network?.isOffline || (Boolean(personalDetails) && personalDetails?.isLoading !== undefined)) { return; } + PersonalDetails.openPersonalDetailsPage(); - }, [isOffline]); + }, [network?.isOffline]); }