From 127690373175e31dd23b842841e487d451554d09 Mon Sep 17 00:00:00 2001 From: annaweber Date: Sat, 13 Dec 2025 23:49:00 -0800 Subject: [PATCH 1/3] fix: Report-Expense report thread and reply title is shown as In workspace --- src/libs/ReportUtils.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 8cd4237b531a3..39a393b66b212 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6107,6 +6107,37 @@ function getReportName( function getSearchReportName(props: GetReportNameParams): string { const {report, policy} = props; if (isChatThread(report) && policy?.name) { + // Traverse up the parent chain to find the first expense report + // If found, return the expense report name instead of workspace name + let currentParent = getParentReport(report); + const visitedReportIDs = new Set(); + + while (currentParent) { + // Prevent infinite loops in case of circular references + if (visitedReportIDs.has(currentParent.reportID)) { + break; + } + visitedReportIDs.add(currentParent.reportID); + + if (isExpenseReport(currentParent)) { + return getReportName( + currentParent, + policy, + props.parentReportActionParam, + props.personalDetails, + props.invoiceReceiverPolicy, + undefined, + props.transactions, + props.isReportArchived, + props.reports, + props.policies, + ); + } + + // Continue traversing up the parent chain + currentParent = getParentReport(currentParent); + } + return policy.name; } // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 From 942b43fb36155f65d0dd0a4b51ba847a989f4fcb Mon Sep 17 00:00:00 2001 From: annaweber Date: Sun, 14 Dec 2025 00:38:47 -0800 Subject: [PATCH 2/3] fix: prettier error --- src/libs/ReportUtils.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 39a393b66b212..5082a7e401ec1 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6111,15 +6111,16 @@ function getSearchReportName(props: GetReportNameParams): string { // If found, return the expense report name instead of workspace name let currentParent = getParentReport(report); const visitedReportIDs = new Set(); - + while (currentParent) { // Prevent infinite loops in case of circular references if (visitedReportIDs.has(currentParent.reportID)) { break; } visitedReportIDs.add(currentParent.reportID); - + if (isExpenseReport(currentParent)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return getReportName( currentParent, policy, @@ -6133,11 +6134,11 @@ function getSearchReportName(props: GetReportNameParams): string { props.policies, ); } - + // Continue traversing up the parent chain currentParent = getParentReport(currentParent); } - + return policy.name; } // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 From 89d874a059f3ac4095f8ac82182f180736342f6f Mon Sep 17 00:00:00 2001 From: annaweber Date: Wed, 7 Jan 2026 14:03:51 -0800 Subject: [PATCH 3/3] fix: prevent parent report ID --- src/libs/ReportUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 5082a7e401ec1..3240279950644 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6113,7 +6113,9 @@ function getSearchReportName(props: GetReportNameParams): string { const visitedReportIDs = new Set(); while (currentParent) { - // Prevent infinite loops in case of circular references + if (!currentParent.reportID) { + break; + } if (visitedReportIDs.has(currentParent.reportID)) { break; }