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 2025-08-07] [$125] Memoize getValidOptions across components #67032
In a few components (UserSelectPopup, NewChatPage etc.) that render options list, the getValidOptions helper is used to determine which options to display. getValidOptions is called on every option manipulation by the user (e.g. adding user to filter or newly created chat) and takes quite a lot of time to process the data.
Solution
getValidOptions can be extracted into separate useMemo that is not combined with selectedOptions (dependency that changes on each interaction).
getValidOptions uses selectedOptions to set isSelected property but in case of those lists these won't be used anyways (selection state is handled on the component level, making it redundant). What we need to take care of is to remove duplicates, which is also done by the next step in data pipeline filterAndOrderOptions (or could be added with filterSelectedOptions helper which exists in the draft PR).
Alternative solution
Memoize getValidOptions itself with memoize helper. It should persist the memoization between screen transitions, making subsequent openings of affected screens quicker (as getValidOptions will hold its memoized version and just retrieve that instead of doing it once again on mount). However, it comes with tradeoff of keeping previous arguments in memory.
changed the title [-][$250] Memoize getValidOptions across components[/-][+][Due for payment 2025-08-07] [$250] Memoize getValidOptions across components[/+]on Jul 31, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.87-14 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@thesahindia] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
[@bfitzexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.
changed the title [-][Due for payment 2025-08-07] [$250] Memoize getValidOptions across components[/-][+][Due for payment 2025-08-07] [$125] Memoize getValidOptions across components[/+]on Aug 4, 2025
Activity
melvin-bot commentedon Jul 24, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021948303128396747028
[-]Memoize getValidOptions across components[/-][+][$250] Memoize getValidOptions across components[/+]melvin-bot commentedon Jul 24, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (
External)melvin-bot commentedon Jul 24, 2025
Triggered auto assignment to @bfitzexpensify (
NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.6 remaining items
[-][$250] Memoize getValidOptions across components[/-][+][Due for payment 2025-08-07] [$250] Memoize getValidOptions across components[/+]melvin-bot commentedon Jul 31, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.87-14 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-08-07. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jul 31, 2025
BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
mountiny commentedon Aug 4, 2025
This should be ready for payment.
$125 to @thesahindia because there were regressions in staging
[-][Due for payment 2025-08-07] [$250] Memoize getValidOptions across components[/-][+][Due for payment 2025-08-07] [$125] Memoize getValidOptions across components[/+]melvin-bot commentedon Aug 4, 2025
bfitzexpensify commentedon Aug 7, 2025
Payment summary:
@thesahindia due $125 via NewDot manual request
twisterdotcom commentedon Sep 3, 2025
@thesahindia has submitted payment for this report on ND here.
SO: https://stackoverflowteams.com/c/expensify/questions/7582
Zapier Logs
Run ID: 00040eee-86f8-a823-53e8-f518ed7eaeb1