From 59644915f66152e74f56a97c8b60397b93cb8477 Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Wed, 3 Jun 2026 17:05:55 +0200 Subject: [PATCH] Fix fragment.text literal and close search RHP after deleting last message --- src/libs/actions/Report/index.ts | 10 ++++++++++ src/pages/inbox/report/ReportActionItemFragment.tsx | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Report/index.ts b/src/libs/actions/Report/index.ts index ca30e95c59ac..aa29dfcb0759 100644 --- a/src/libs/actions/Report/index.ts +++ b/src/libs/actions/Report/index.ts @@ -3132,6 +3132,16 @@ function deleteReportComment( Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportID)); } else if (Navigation.isActiveRoute(ROUTES.REPORT_WITH_ID.getRoute(reportAction.childReportID)) && !isDeletedParentAction) { Navigation.goBack(undefined); + } else if ( + // When this report is the one currently displayed at the top of the search RHP (/search/view/:reportID) and + // deleting this comment leaves it without any visible actions, pop just this RHP screen so we don't show an empty + // report. We use goBack (not dismissModal) so any wider RHP screens stacked below remain open. Deleted parent + // messages stay visible as a "[Deleted message]" placeholder, so we skip closing in that case. + Navigation.getTopmostSearchReportID() === reportID && + !isDeletedParentAction && + !ReportActionsUtils.doesReportHaveVisibleActions(reportID, canUserPerformWriteAction, optimisticReportActions as ReportActions, visibleReportActionsDataParam) + ) { + Navigation.goBack(); } } diff --git a/src/pages/inbox/report/ReportActionItemFragment.tsx b/src/pages/inbox/report/ReportActionItemFragment.tsx index 3aab254ecf0e..a65c5eb93069 100644 --- a/src/pages/inbox/report/ReportActionItemFragment.tsx +++ b/src/pages/inbox/report/ReportActionItemFragment.tsx @@ -195,7 +195,7 @@ function ReportActionItemFragment({ case 'OLD_MESSAGE': return OLD_MESSAGE; default: - return fragment.text; + return {fragment?.text ?? ''}; } }