From e13f0ecd3334e81d07e126d1ddaeb25eb55f70bc Mon Sep 17 00:00:00 2001 From: kubabutkiewicz Date: Fri, 20 Feb 2026 08:13:26 +0100 Subject: [PATCH 1/2] pass policyTags to getOptionData --- .../LHNOptionsList/LHNOptionsList.tsx | 9 ++++++++- .../LHNOptionsList/OptionRowLHNData.tsx | 6 +++++- src/libs/SidebarUtils.ts | 18 +++++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index a25be06bf7ac0..f687d197a5788 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -18,8 +18,8 @@ import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useOnyx from '@hooks/useOnyx'; import usePolicyForMovingExpenses from '@hooks/usePolicyForMovingExpenses'; -import useReportAttributes from '@hooks/useReportAttributes'; import usePrevious from '@hooks/usePrevious'; +import useReportAttributes from '@hooks/useReportAttributes'; import useRootNavigationState from '@hooks/useRootNavigationState'; import useScrollEventEmitter from '@hooks/useScrollEventEmitter'; import useTheme from '@hooks/useTheme'; @@ -75,6 +75,8 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio const [isFullscreenVisible] = useOnyx(ONYXKEYS.FULLSCREEN_VISIBILITY, {canBeMissing: true}); const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); const {policyForMovingExpensesID} = usePolicyForMovingExpenses(); + const {login} = useCurrentUserPersonalDetails(); + const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}`, {canBeMissing: true}); const theme = useTheme(); const styles = useThemeStyles(); @@ -183,6 +185,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio const itemParentReportActions = reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${item?.parentReportID}`]; const itemParentReportAction = item?.parentReportActionID ? itemParentReportActions?.[item?.parentReportActionID] : undefined; const itemReportAttributes = reportAttributes?.[reportID]; + const itemPolicyTags = policyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${item?.policyID}`]; let invoiceReceiverPolicyID = '-1'; if (item?.invoiceReceiver && 'policyID' in item.invoiceReceiver) { @@ -241,6 +244,8 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio policyForMovingExpensesID, reportMetadata: itemReportMetadata, reportAttributesDerived: reportAttributes, + policyTags: itemPolicyTags, + currentUserLogin: login, }); const shouldShowRBRorGBRTooltip = firstReportIDWithGBRorRBR === reportID; @@ -333,6 +338,8 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio localeCompare, translate, currentUserAccountID, + login, + policyTags, ], ); diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index 05123725c9af3..36258f77e0ffc 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'; @@ -49,10 +50,11 @@ function OptionRowLHNData({ const {currentReportID: currentReportIDValue} = useCurrentReportIDState(); const isReportFocused = isOptionFocused && currentReportIDValue === reportID; const optionItemRef = useRef(undefined); - + const {login} = useCurrentUserPersonalDetails(); const [movedFromReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.FROM)}`, {canBeMissing: true}); const [movedToReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.TO)}`, {canBeMissing: true}); const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID, {canBeMissing: true}); + const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${fullReport?.policyID}`, {canBeMissing: true}); // 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 +84,8 @@ function OptionRowLHNData({ movedToReport, currentUserAccountID, reportAttributesDerived, + policyTags, + currentUserLogin: login, }); if (deepEqual(item, optionItemRef.current)) { return optionItemRef.current; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 4a75fbc26f665..f414cf35dffc2 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -5,7 +5,17 @@ import type {LocaleContextProps, LocalizedTranslate} from '@components/LocaleCon import type {PartialPolicyForSidebar, ReportsToDisplayInLHN} from '@hooks/useSidebarOrderedReports'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {Card, PersonalDetails, PersonalDetailsList, ReportActions, ReportAttributesDerivedValue, ReportNameValuePairs, Transaction, TransactionViolation} from '@src/types/onyx'; +import type { + Card, + PersonalDetails, + PersonalDetailsList, + PolicyTagLists, + ReportActions, + ReportAttributesDerivedValue, + ReportNameValuePairs, + Transaction, + TransactionViolation, +} from '@src/types/onyx'; import type Beta from '@src/types/onyx/Beta'; import type {ReportAttributes} from '@src/types/onyx/DerivedValues'; import type {Errors} from '@src/types/onyx/OnyxCommon'; @@ -679,6 +689,8 @@ function getOptionData({ movedToReport, currentUserAccountID, reportAttributesDerived, + policyTags, + currentUserLogin, }: { report: OnyxEntry; oneTransactionThreadReport: OnyxEntry; @@ -700,6 +712,8 @@ function getOptionData({ movedToReport?: OnyxEntry; currentUserAccountID: number; 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 @@ -839,6 +853,8 @@ function getOptionData({ policy, isReportArchived, reportAttributesDerived, + policyTags, + currentUserLogin, }); } From 5ac02c3aac769904c64606522a9754183a0f90a3 Mon Sep 17 00:00:00 2001 From: kubabutkiewicz Date: Fri, 20 Feb 2026 08:31:44 +0100 Subject: [PATCH 2/2] fix ai reviewer comments --- src/components/LHNOptionsList/LHNOptionsList.tsx | 3 +-- src/components/LHNOptionsList/OptionRowLHNData.tsx | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index f687d197a5788..3ab10f800a5fe 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -73,9 +73,8 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true}); const [onboarding] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {canBeMissing: true}); const [isFullscreenVisible] = useOnyx(ONYXKEYS.FULLSCREEN_VISIBILITY, {canBeMissing: true}); - const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); + const {accountID: currentUserAccountID, login} = useCurrentUserPersonalDetails(); const {policyForMovingExpensesID} = usePolicyForMovingExpenses(); - const {login} = useCurrentUserPersonalDetails(); const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}`, {canBeMissing: true}); const theme = useTheme(); diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index 36258f77e0ffc..02e997bad3dc4 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.tsx +++ b/src/components/LHNOptionsList/OptionRowLHNData.tsx @@ -124,6 +124,8 @@ function OptionRowLHNData({ movedToReport, currentUserAccountID, reportAttributesDerived, + policyTags, + login, ]); return (