@@ -22,7 +22,8 @@ import {getDestinationForDisplay, getSubratesFields, getSubratesForDisplay, getT
2222import { canSendInvoice , getPerDiemCustomUnit } from '@libs/PolicyUtils' ;
2323import type { ThumbnailAndImageURI } from '@libs/ReceiptUtils' ;
2424import { getThumbnailAndImageURIs } from '@libs/ReceiptUtils' ;
25- import { generateReportID , getDefaultWorkspaceAvatar , getOutstandingReportsForUser , getReportName , isArchivedReport , isMoneyRequestReport , isReportOutstanding } from '@libs/ReportUtils' ;
25+ import { computeReportName } from '@libs/ReportNameUtils' ;
26+ import { generateReportID , getDefaultWorkspaceAvatar , getOutstandingReportsForUser , isArchivedReport , isMoneyRequestReport , isReportOutstanding } from '@libs/ReportUtils' ;
2627import { getTagVisibility , hasEnabledTags } from '@libs/TagsOptionsListUtils' ;
2728import {
2829 getTagForDisplay ,
@@ -321,7 +322,6 @@ function MoneyRequestConfirmationListFooter({
321322 */
322323 const transactionReport = transaction ?. reportID ? Object . values ( allReports ?? { } ) . find ( ( report ) => report ?. reportID === transaction . reportID ) : undefined ;
323324 const policyID = selectedParticipants ?. at ( 0 ) ?. policyID ;
324- const selectedPolicy = allPolicies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ] ;
325325 const shouldUseTransactionReport = ( ! ! transactionReport && isReportOutstanding ( transactionReport , policyID , undefined , false ) ) || isUnreported ;
326326
327327 const ownerAccountID = selectedParticipants ?. at ( 0 ) ?. ownerAccountID ;
@@ -346,12 +346,12 @@ function MoneyRequestConfirmationListFooter({
346346 } , [ allReports , shouldUseTransactionReport , transaction ?. reportID , outstandingReportID ] ) ;
347347
348348 const reportName = useMemo ( ( ) => {
349- const name = getReportName ( selectedReport , selectedPolicy ) ;
349+ const name = computeReportName ( selectedReport , allReports , allPolicies ) ;
350350 if ( ! name ) {
351351 return isUnreported ? translate ( 'common.none' ) : translate ( 'iou.newReport' ) ;
352352 }
353353 return name ;
354- } , [ isUnreported , selectedReport , selectedPolicy , translate ] ) ;
354+ } , [ isUnreported , selectedReport , allReports , allPolicies , translate ] ) ;
355355
356356 const shouldReportBeEditableFromFAB = isUnreported ? allOutstandingReports . length >= 1 : allOutstandingReports . length > 1 ;
357357
0 commit comments