Skip to content

Commit 68f8f82

Browse files
authored
Merge pull request Expensify#68333 from nkdengineer/fix/67091
fix: remove call to getReportNameValuePairs() in method findLastAccessedReport
2 parents f5698b9 + 5b71dbb commit 68f8f82

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
@@ -1974,6 +1974,10 @@ function getMostRecentlyVisitedReport(reports: Array<OnyxEntry<Report>>, reportM
19741974
return lodashMaxBy(filteredReports, (a) => [reportMetadata?.[`${ONYXKEYS.COLLECTION.REPORT_METADATA}${a?.reportID}`]?.lastVisitTime ?? '', a?.lastReadTime ?? '']);
19751975
}
19761976

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

0 commit comments

Comments
 (0)