From 0538779a95aeafe5dc9d745ce248f6f392766a41 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 25 Jun 2024 12:13:23 +0800 Subject: [PATCH] fix optimistic report preview message is empty --- src/libs/ReportUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 4d83b2b82445..41739593f53f 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2939,7 +2939,7 @@ function getReportPreviewMessage( const report = typeof reportOrID === 'string' ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportOrID}`] : reportOrID; const reportActionMessage = ReportActionsUtils.getReportActionHtml(iouReportAction); - if (isEmptyObject(report) || !report?.reportID || isEmptyObject(iouReportAction)) { + if (isEmptyObject(report) || !report?.reportID) { // The iouReport is not found locally after SignIn because the OpenApp API won't return iouReports if they're settled // As a temporary solution until we know how to solve this the best, we just use the message that returned from BE return reportActionMessage; @@ -3017,7 +3017,7 @@ function getReportPreviewMessage( return Localize.translateLocal('iou.fieldPending'); } - const originalMessage = ReportActionsUtils.isMoneyRequestAction(iouReportAction) ? ReportActionsUtils.getOriginalMessage(iouReportAction) : undefined; + const originalMessage = !isEmptyObject(iouReportAction) && ReportActionsUtils.isMoneyRequestAction(iouReportAction) ? ReportActionsUtils.getOriginalMessage(iouReportAction) : undefined; // Show Paid preview message if it's settled or if the amount is paid & stuck at receivers end for only chat reports. if (isSettled(report.reportID) || (report.isWaitingOnBankAccount && isPreviewMessageForParentChatReport)) {