From 1b54f35d09269002afba98ff9d88f0fe5977902c Mon Sep 17 00:00:00 2001 From: Youssef Lourayad Date: Tue, 18 Aug 2026 06:00:06 +0000 Subject: [PATCH] fix: fall back to iouReportID for LHN action badge when REPORT_ACTIONS not yet hydrated Pinning a previously-hidden chat can surface it in the LHN before its REPORT_ACTIONS are loaded. hasOutstandingChildRequest already lights up the GBR dot at that point, but the badge lookup only scans loaded REPORT_PREVIEW actions and comes back empty, so Pay/Approve never renders. Fixes https://github.com/Expensify/Expensify/issues/670825 --- src/libs/actions/IOU/ReportWorkflow.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libs/actions/IOU/ReportWorkflow.ts b/src/libs/actions/IOU/ReportWorkflow.ts index de9551cd17dd..5a5c56342869 100644 --- a/src/libs/actions/IOU/ReportWorkflow.ts +++ b/src/libs/actions/IOU/ReportWorkflow.ts @@ -428,6 +428,17 @@ function getIOUReportActionWithBadge( } } + // A chat's hasOutstandingChildRequest flag can flip true before its REPORT_ACTIONS are hydrated locally + // (e.g. pinning a previously-hidden chat pulls it into the LHN ahead of OpenReport, see + // https://github.com/Expensify/Expensify/issues/670825). When that happens the loop above finds no + // REPORT_PREVIEW action to badge, so fall back to the chat's iouReportID directly. + if (!actionBadge && chatReport?.hasOutstandingChildRequest && chatReport?.iouReportID) { + const iouReport = getReportOrDraftReport(chatReport.iouReportID, undefined, undefined, undefined, allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${chatReport.iouReportID}`]); + if (iouReport && !isReportPendingDelete(iouReport)) { + actionBadge = getBadgeFromIOUReport(iouReport, chatReport, policy, reportMetadata, invoiceReceiverPolicy, currentUserLogin, currentUserAccountID); + } + } + return {reportAction: earliestAction, actionBadge}; }