Skip to content

Commit 5b71dbb

Browse files
committed
fix: remove call to getReportNameValuePairs() in method findLastAccessedReport
1 parent f1fe459 commit 5b71dbb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/libs/ReportUtils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,6 +1972,10 @@ function getMostRecentlyVisitedReport(reports: Array<OnyxEntry<Report>>, reportM
19721972
return lodashMaxBy(filteredReports, (a) => [reportMetadata?.[`${ONYXKEYS.COLLECTION.REPORT_METADATA}${a?.reportID}`]?.lastVisitTime ?? '', a?.lastReadTime ?? '']);
19731973
}
19741974

1975+
/**
1976+
* This function is used to find the last accessed report and we don't need to subscribe the data in the UI.
1977+
* So please use `Onyx.connectWithoutView()` to get the necessary data when we remove the `Onyx.connect()`
1978+
*/
19751979
function findLastAccessedReport(ignoreDomainRooms: boolean, openOnAdminRoom = false, policyID?: string, excludeReportID?: string): OnyxEntry<Report> {
19761980
// If it's the user's first time using New Expensify, then they could either have:
19771981
// - just a Concierge report, if so we'll return that
@@ -2021,10 +2025,7 @@ function findLastAccessedReport(ignoreDomainRooms: boolean, openOnAdminRoom = fa
20212025
// and it prompts the user to use the Concierge chat instead.
20222026
reportsValues =
20232027
reportsValues.filter((report) => {
2024-
// This will get removed as part of https://github.com/Expensify/App/issues/59961
2025-
// eslint-disable-next-line deprecation/deprecation
2026-
const reportNameValuePairs = getReportNameValuePairs(report?.reportID);
2027-
2028+
const reportNameValuePairs = allReportNameValuePair?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`];
20282029
return !isSystemChat(report) && !isArchivedReport(reportNameValuePairs);
20292030
}) ?? [];
20302031

0 commit comments

Comments
 (0)