diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 7c482339da47..1b535f72fca9 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -897,7 +897,7 @@ function deleteReportComment(reportID, reportAction) { lastMessageText: '', lastVisibleActionCreated: '', }; - if (reportAction.reportActionID && reportAction.childVisibleActionCount > 0) { + if (reportAction.childVisibleActionCount === 0) { optimisticReport = { lastMessageTranslationKey: '', lastMessageText: '', @@ -963,6 +963,16 @@ function deleteReportComment(reportID, reportAction) { optimisticData.push(optimisticParentReportData); } + // Check to see if the report action we are deleting is the first comment on a thread report. In this case, we need to trigger + // an update to let the LHN know that the parentReportAction is now deleted. + if (ReportUtils.isThreadFirstChat(reportAction, reportID)) { + optimisticData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, + value: {updateReportInLHN: true}, + }); + } + const parameters = { reportID: originalReportID, reportActionID,