Skip to content

[Due for payment 2026-05-29] perf:hoist totalSelectableItemsCount out of updateSelectAllM… #91286

Description

@mountiny

Problem

In Search, updateSelectAllMatchingItemsState recalculated totalSelectableItemsCount on every invocation by scanning filteredData (including grouped expense reports and pending-delete filtering). The callback also depended on filteredData, validGroupBy, and search type, so it was recreated frequently and repeated expensive counting work during row selection.

Solution

Hoisted totalSelectableItemsCount into a useMemo keyed on areItemsGrouped and filteredData, and updated updateSelectAllMatchingItemsState to read the memoized count instead of recomputing it. Narrowed the callback dependency list to totalSelectableItemsCount and the select-all-matching flags, and reused the shared areItemsGrouped flag in toggleAllTransactions to avoid duplicate logic.

PR

#91186

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2Task

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions