Problem
findLastAccessedReport previously required callers to pass a pre-built ArchivedReportsIDSet — a Set covering all archived report IDs. Every caller had to build that set by iterating the full reportNameValuePairs collection first, which is expensive at scale (~100k entries on high-traffic accounts) and added roughly 14s to app startup and report opening.
Solution
Changed the 4th parameter of findLastAccessedReport to accept the raw OnyxCollection<ReportNameValuePairs> instead of a pre-built Set. Archived status is now checked via a direct O(1) per-report key lookup (isArchivedReport(reportNameValuePairsCollection?.[key])) during filtering, eliminating upfront Set construction. All callers were updated to pass the collection they already subscribe to via useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS). A module-scoped Onyx.connect fallback is kept for the rare cases where no collection is passed.
PR
#94146
Issue Owner
Current Issue Owner: @mallenexpensify
Problem
findLastAccessedReportpreviously required callers to pass a pre-builtArchivedReportsIDSet— aSetcovering all archived report IDs. Every caller had to build that set by iterating the fullreportNameValuePairscollection first, which is expensive at scale (~100k entries on high-traffic accounts) and added roughly 14s to app startup and report opening.Solution
Changed the 4th parameter of
findLastAccessedReportto accept the rawOnyxCollection<ReportNameValuePairs>instead of a pre-built Set. Archived status is now checked via a direct O(1) per-report key lookup (isArchivedReport(reportNameValuePairsCollection?.[key])) during filtering, eliminating upfront Set construction. All callers were updated to pass the collection they already subscribe to viauseOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS). A module-scopedOnyx.connectfallback is kept for the rare cases where no collection is passed.PR
#94146
Issue Owner
Current Issue Owner: @mallenexpensify