Problem
The Search getSections pipeline (Search/index.tsx and useSearchSections.ts) used useArchivedReportsIDSet(), which subscribed to the entire REPORT_NAME_VALUE_PAIRS collection and rebuilt a Set via an O(n) Object.entries scan on every collection change — for every search type. This was wasteful because getSections only needs a single report's archived status, and only for task searches.
Solution
Removed useArchivedReportsIDSet() from the Search pipeline. Components now pass the raw reportNameValuePairs collection into getSections/getTaskSections, which calls isArchivedReport(reportNameValuePairs?.[key]) directly (O(1) lookup) where needed. Same data source and coverage as before; the eager Set construction is eliminated.
PR
#94182
Issue Owner
Current Issue Owner: @mallenexpensify
Problem
The Search
getSectionspipeline (Search/index.tsxanduseSearchSections.ts) useduseArchivedReportsIDSet(), which subscribed to the entireREPORT_NAME_VALUE_PAIRScollection and rebuilt aSetvia an O(n)Object.entriesscan on every collection change — for every search type. This was wasteful becausegetSectionsonly needs a single report's archived status, and only for task searches.Solution
Removed
useArchivedReportsIDSet()from the Search pipeline. Components now pass the rawreportNameValuePairscollection intogetSections/getTaskSections, which callsisArchivedReport(reportNameValuePairs?.[key])directly (O(1) lookup) where needed. Same data source and coverage as before; the eager Set construction is eliminated.PR
#94182
Issue Owner
Current Issue Owner: @mallenexpensify