diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index 9097eeb112131..6c20ac9e12233 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -267,11 +267,10 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio ); }, [ + reportAttributes, reports, reportNameValuePairs, reportActions, - isOffline, - reportAttributes, policy, transactions, draftComments, diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index 917f4023e5efe..3352f57699300 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.tsx +++ b/src/components/LHNOptionsList/OptionRowLHNData.tsx @@ -1,6 +1,7 @@ import {deepEqual} from 'fast-equals'; import React, {useMemo, useRef} from 'react'; import {useCurrentReportIDState} from '@hooks/useCurrentReportID'; +import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useGetExpensifyCardFromReportAction from '@hooks/useGetExpensifyCardFromReportAction'; import useOnyx from '@hooks/useOnyx'; import usePrevious from '@hooks/usePrevious'; @@ -53,6 +54,8 @@ function OptionRowLHNData({ const [movedFromReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.FROM)}`); const [movedToReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.TO)}`); const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); + const {login} = useCurrentUserPersonalDetails(); + const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${fullReport?.policyID}`); // Check the report errors equality to avoid re-rendering when there are no changes const prevReportErrors = usePrevious(reportAttributes?.reportErrors); const areReportErrorsEqual = useMemo(() => deepEqual(prevReportErrors, reportAttributes?.reportErrors), [prevReportErrors, reportAttributes?.reportErrors]); @@ -82,6 +85,8 @@ function OptionRowLHNData({ movedToReport, currentUserAccountID, reportAttributesDerived, + policyTags, + currentUserLogin: login, }); if (deepEqual(item, optionItemRef.current)) { return optionItemRef.current; @@ -123,6 +128,8 @@ function OptionRowLHNData({ movedToReport, currentUserAccountID, reportAttributesDerived, + policyTags, + login, ]); return ( diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 0be9cefa99dfc..2c46f9e0e6c7f 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -9,6 +9,7 @@ import type { Card, PersonalDetails, PersonalDetailsList, + PolicyTagLists, ReportActions, ReportAttributesDerivedValue, ReportNameValuePairs, @@ -672,6 +673,8 @@ function getOptionData({ currentUserAccountID, visibleReportActionsData, reportAttributesDerived, + policyTags, + currentUserLogin, }: { report: OnyxEntry; oneTransactionThreadReport: OnyxEntry; @@ -694,6 +697,8 @@ function getOptionData({ currentUserAccountID: number; visibleReportActionsData?: VisibleReportActionsDerivedValue; reportAttributesDerived?: ReportAttributesDerivedValue['reports']; + policyTags?: OnyxEntry; + currentUserLogin?: string; }): OptionData | undefined { // When a user signs out, Onyx is cleared. Due to the lazy rendering with a virtual list, it's possible for // this method to be called after the Onyx data has been cleared out. In that case, it's fine to do @@ -834,6 +839,8 @@ function getOptionData({ isReportArchived, reportMetadata, reportAttributesDerived, + policyTags, + currentUserLogin, lastAction, }); }