Problem
toggleTransaction in Search depended on filteredData because setSelectedTransactions took the visible rows as a second argument to derive selectedReports for bulk actions (export, approve, pay, etc.). filteredData is a large, reference-unstable array that changes on every search refresh, snapshot bump, filter change, or pagination. That kept toggleTransaction in the dependency array and forced the callback to be recreated constantly, churning memoized row items and footer controls.
Solution
Split report derivation out of setSelectedTransactions: moved the logic into deriveSelectedReports and a new setSelectedReports action, and added useSyncSelectedReports(filteredData) in the Search component to keep selectedReports in sync via a dedicated effect. toggleTransaction and other selection paths now call setSelectedTransactions without passing filteredData, so the callback no longer depends on the unstable search list reference while bulk actions still receive correct report metadata.
PR
#91188
Issue Owner
Current Issue Owner: @mallenexpensify
Problem
toggleTransactionin Search depended onfilteredDatabecausesetSelectedTransactionstook the visible rows as a second argument to deriveselectedReportsfor bulk actions (export, approve, pay, etc.).filteredDatais a large, reference-unstable array that changes on every search refresh, snapshot bump, filter change, or pagination. That kepttoggleTransactionin the dependency array and forced the callback to be recreated constantly, churning memoized row items and footer controls.Solution
Split report derivation out of
setSelectedTransactions: moved the logic intoderiveSelectedReportsand a newsetSelectedReportsaction, and addeduseSyncSelectedReports(filteredData)in the Search component to keepselectedReportsin sync via a dedicated effect.toggleTransactionand other selection paths now callsetSelectedTransactionswithout passingfilteredData, so the callback no longer depends on the unstable search list reference while bulk actions still receive correct report metadata.PR
#91188
Issue Owner
Current Issue Owner: @mallenexpensify