diff --git a/src/hooks/useCurrentReportID.tsx b/src/hooks/useCurrentReportID.tsx index 8a97c28c0333..4f7a5206eaea 100644 --- a/src/hooks/useCurrentReportID.tsx +++ b/src/hooks/useCurrentReportID.tsx @@ -1,14 +1,10 @@ import type {NavigationState} from '@react-navigation/native'; import React, {createContext, useCallback, useContext, useMemo, useState} from 'react'; import Navigation from '@libs/Navigation/Navigation'; -import {getReportIDFromLink} from '@libs/ReportUtils'; -import ONYXKEYS from '@src/ONYXKEYS'; -import useOnyx from './useOnyx'; type CurrentReportIDContextValue = { updateCurrentReportID: (state: NavigationState) => void; currentReportID: string | undefined; - currentReportIDFromPath: string | undefined; }; type CurrentReportIDContextProviderProps = { @@ -25,8 +21,6 @@ const CurrentReportIDContext = createContext function CurrentReportIDContextProvider(props: CurrentReportIDContextProviderProps) { const [currentReportID, setCurrentReportID] = useState(''); - const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH, {canBeMissing: true}); - const lastAccessReportFromPath = getReportIDFromLink(lastVisitedPath ?? null); /** * This function is used to update the currentReportID @@ -70,9 +64,8 @@ function CurrentReportIDContextProvider(props: CurrentReportIDContextProviderPro (): CurrentReportIDContextValue => ({ updateCurrentReportID, currentReportID, - currentReportIDFromPath: lastAccessReportFromPath || undefined, }), - [updateCurrentReportID, currentReportID, lastAccessReportFromPath], + [updateCurrentReportID, currentReportID], ); return {props.children}; diff --git a/src/hooks/useSidebarOrderedReports.tsx b/src/hooks/useSidebarOrderedReports.tsx index def62f1f6308..0b5e14b90508 100644 --- a/src/hooks/useSidebarOrderedReports.tsx +++ b/src/hooks/useSidebarOrderedReports.tsx @@ -78,7 +78,7 @@ function SidebarOrderedReportsContextProvider({ const {shouldUseNarrowLayout} = useResponsiveLayout(); const {accountID} = useCurrentUserPersonalDetails(); const currentReportIDValue = useCurrentReportID(); - const derivedCurrentReportID = currentReportIDForTests ?? currentReportIDValue?.currentReportIDFromPath ?? currentReportIDValue?.currentReportID; + const derivedCurrentReportID = currentReportIDForTests ?? currentReportIDValue?.currentReportID; const prevDerivedCurrentReportID = usePrevious(derivedCurrentReportID); const policyMemberAccountIDs = useMemo(() => getPolicyEmployeeListByIdWithoutCurrentUser(policies, undefined, accountID), [policies, accountID]);