You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-03-19] [$250] [Performance] Optimize useAdvancedSearchFilters (~18ms per render) #82423
useAdvancedSearchFilters takes ~18ms per render and contributes to slow Reports page navigation.
Solution
Optimize the hook (e.g. memoization, reducing work per render, or moving work off the critical path). Use React Profiler / Chrome DevTools to validate improvements.
Issue OwnerCurrent Issue Owner: @mallenexpensifyUpwork Automation - Do Not Edit
changed the title [-][Performance] Optimize useAdvancedSearchFilters (~18ms per render)[/-][+][$250] [Performance] Optimize useAdvancedSearchFilters (~18ms per render)[/+]on Feb 19, 2026
Please re-state the problem that we are trying to solve in this issue.
`useAdvancedSearchFilters` runs ~18ms of computation on every render due to multiple unmemoized expensive operations across Onyx collections.
What is the root cause of that problem?
The hook performs six expensive computations on every render with no memoization:
`getAllTaxRates(policies)` — iterates all policies to collect tax rates
`getAllPolicyValues(policyID, ...)` — called twice, scans policy collections
`tagListsUnpacked` — chains `.filter().map().flat()` across all policy tag lists
`nonPersonalPolicyCategoryCount` — builds a `new Set()` and filters every render
`shouldDisplayReportFieldFilter` — iterates all policies and their `fieldList`
`useWorkspaceList()` returns a new object reference every render
The hook subscribes to multiple Onyx stores, so any store update triggers a re-render that re-runs all six computations from scratch even when the relevant inputs haven't changed.
What changes do you think we should make in order to solve the problem?
Wrap each expensive computation in `useMemo` with targeted dependency arrays:
Tax rates: `useMemo(() => getAllTaxRates(policies), [policies])` — same pattern already used in `useFilterFormValues`
Policy values: Memoize both `getAllPolicyValues` calls with their respective dependencies
Tag lists unpacking: `useMemo(() => policyTagsLists?.filter().map().flat(), [policyTagsLists])`
Category count: `useMemo(() => { const s = new Set(...); return s.size; }, [policyCategories])`
Report field filter: `useMemo(() => checkReportFieldDisplay(policies), [policies])`
Workspace list stability: Extract into a stable selector or use `useRef` comparison to prevent unnecessary downstream invalidation
Where applicable, I'll use Onyx's built-in `selector` option (the same pattern as `availablePolicyCategoriesSelector` already defined in the codebase) to push filtering closer to the data source.
I will validate each memoization point individually with React Profiler to confirm the cumulative ~18ms reduction.
⚠️ @imgyf Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Activity
melvin-bot commentedon Feb 19, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (
External)[-][Performance] Optimize useAdvancedSearchFilters (~18ms per render)[/-][+][$250] [Performance] Optimize useAdvancedSearchFilters (~18ms per render)[/+]melvin-bot commentedon Feb 19, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022024628964028802674
mas7 commentedon Feb 21, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
`useAdvancedSearchFilters` runs ~18ms of computation on every render due to multiple unmemoized expensive operations across Onyx collections.
What is the root cause of that problem?
The hook performs six expensive computations on every render with no memoization:
The hook subscribes to multiple Onyx stores, so any store update triggers a re-render that re-runs all six computations from scratch even when the relevant inputs haven't changed.
What changes do you think we should make in order to solve the problem?
Wrap each expensive computation in `useMemo` with targeted dependency arrays:
Where applicable, I'll use Onyx's built-in `selector` option (the same pattern as `availablePolicyCategoriesSelector` already defined in the codebase) to push filtering closer to the data source.
I will validate each memoization point individually with React Profiler to confirm the cumulative ~18ms reduction.
yifangoh commentedon Feb 22, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon Feb 22, 2026
melvin-bot commentedon Feb 23, 2026
@aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
39 remaining items
melvin-bot commentedon Mar 12, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)mallenexpensify commentedon Mar 20, 2026
Payment Summary
Contributor: @TaduJR paid $250 via Upwork
Contributor+: @aimane-chnaif paid $250 via Upwork
@aimane-chnaif plz complete the BZ checklist and tag me in a post once you have. Thx
@TaduJR can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022035102200994135237
aimane-chnaif commentedon Mar 20, 2026
This is performance improvement so we can skip checklist
TaduJR commentedon Mar 21, 2026
Offer Accepted @mallenexpensify
Thanks!
mallenexpensify commentedon Mar 23, 2026
@TaduJR paid, summary updated above.e
Thx