diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 476677285498..cfc5c69e4467 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -910,12 +910,13 @@ function getReportSections(data: OnyxTypes.SearchResults['data'], metadata: Onyx const isIOUReport = reportItem.type === CONST.REPORT.TYPE.IOU; const reportPendingAction = reportItem?.pendingAction ?? reportItem?.pendingFields?.preview; + const shouldShowBlankTo = !reportItem || isOpenExpenseReport(reportItem); reportIDToTransactions[reportKey] = { ...reportItem, action: getAction(data, allViolations, key), keyForList: reportItem.reportID, from: data.personalDetailsList?.[reportItem.accountID ?? CONST.DEFAULT_NUMBER_ID], - to: reportItem.managerID ? data.personalDetailsList?.[reportItem.managerID] : emptyPersonalDetails, + to: !shouldShowBlankTo && reportItem.managerID ? data.personalDetailsList?.[reportItem.managerID] : emptyPersonalDetails, transactions, ...(reportPendingAction ? {pendingAction: reportPendingAction} : {}), }; diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index 1847a27e54fc..93fbb5413beb 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -731,10 +731,10 @@ const reportsListItems = [ stateNum: 0, statusNum: 0, to: { - accountID: 18439984, - avatar: 'https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/avatar_3.png', - displayName: 'Admin', - login: adminEmail, + accountID: 0, + avatar: '', + displayName: undefined, + login: undefined, }, total: -5000, transactions: [