Skip to content

[Due for payment 2025-11-19] [$250] Refactor provided component to use useSearchSelector hook and remove unused and duplicated code (Task 5) #71062

Closed

Description

@pecanoro

Background

Across the application, around 15 components serve the same or very similar functionality: search users. These components use the same source of truth, OptionListContextProvider, and use getValidOptions to properly filter and sort options with contact.

Problem

Although the functionality of these components is almost the same, their implementation is the same or differs slightly. There is a lot of code duplication, which leads to situations where users experience different behaviours across these functionalities.
Working on these components (for example, with performance optimizations) is also problematic for developers, as there are many places that should be checked and updated. For example, when we implemented new parameters in getValidOptions there is a need to update all of these components

Solution

To improve code quality and developers’ and users' experience, we’ve implemented the useSearchSelector hook, which will be a single place of truth for all components that provide user searching. These components serve:

  1. options selection
  2. options sorting
  3. options filtering
  4. phone contacts importing

Using that hook will make the user experience more consistent across all components.

Task 5

Refactor listed components to use useSearchSelector hook and remove unused and duplicated code.
Components:

  1. MoneyRequestParticipantsSelector
  2. VacationDelegatePage

Important notes:

  1. you can use InviteReportParticipantsPage as an example of the implementation
  2. you should use context param: CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_GENERAL
  3. you need to ensure all functionalities are working correctly. Especially: selection, filtering, ordering, and inviting new users

@mountiny @sosek108

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021970468599774553248
  • Upwork Job ID: 1970468599774553248
  • Last Price Increase: 2025-09-23
  • Automatic offers:
    • linhvovan29546 | Reviewer | 108892968
Issue OwnerCurrent Issue Owner: @brianlee-expensify

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 23, 2025
  2. changed the title [-]Refactor provided component to use useSearchSelector hook and remove unused and duplicated code (Task 5)[/-] [+][$250] Refactor provided component to use useSearchSelector hook and remove unused and duplicated code (Task 5)[/+] on Sep 23, 2025
  3. melvin-bot commented on Sep 23, 2025

    @melvin-bot
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Sep 23, 2025
  5. melvin-bot commented on Sep 23, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @linhvovan29546 (External)

  6. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 23, 2025
  7. melvin-bot commented on Sep 23, 2025

    @melvin-bot

    Triggered auto assignment to @brianlee-expensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  8. removed
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 23, 2025
  9. lorretheboy commented on Sep 23, 2025

    @lorretheboy
    Contributor

    I'd like to work on this if it's open for contributors with detailed solution in the OP

    The solution should be similar with InviteReportParticipantsPage in this PR #66964

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Refactor provided component to use useSearchSelector hook and remove unused and duplicated code (Task 5)

    What is the root cause of that problem?

    Improvement

    What changes do you think we should make in order to solve the problem?

    The solution should be similar with InviteReportParticipantsPage in this PR #66964

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    NA

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  10. PiyushChandra17 commented on Sep 23, 2025

    @PiyushChandra17
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Refactor provided component to use useSearchSelector hook and remove unused and duplicated code

    What is the root cause of that problem?

    Refactor

    What changes do you think we should make in order to solve the problem?

    1. We need to refactor MoneyRequestParticipantsSelector && VacationDelegatePage component

    2. Just like we do in InviteReportParticipantsPage

    const {searchTerm, setSearchTerm, availableOptions, selectedOptions, selectedOptionsForDisplay, toggleSelection, areOptionsInitialized, onListEndReached} = useSearchSelector({
    selectionMode: CONST.SEARCH_SELECTOR.SELECTION_MODE_MULTI,
    searchContext: CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_MEMBER_INVITE,
    includeUserToInvite: true,
    excludeLogins: excludedUsers,
    includeRecentReports: true,
    shouldInitialize: didScreenTransitionEnd,
    });

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    n/A

    What alternative solutions did you explore? (Optional)

  11. 38 remaining items

  12. changed the title [-][$250] Refactor provided component to use useSearchSelector hook and remove unused and duplicated code (Task 5)[/-] [+][Due for payment 2025-11-19] [$250] Refactor provided component to use useSearchSelector hook and remove unused and duplicated code (Task 5)[/+] on Nov 12, 2025
  13. melvin-bot commented on Nov 12, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. melvin-bot commented on Nov 12, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.54-1 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-11-19. 🎊

    For reference, here are some details about the assignees on this issue:

  15. brianlee-expensify commented on Nov 13, 2025

    @brianlee-expensify
    Contributor

    @linhvovan29546 can you fill out the bugzero checklist and confirm whether this needs a regression test?

    also note that you're assigned the 2nd bulletpoint in the automated comment above when you should be on the 3rd bulletpoint (essentially switching places with @lorretheboy), @mallenexpensify is aware of this and will work on a fix

  16. linhvovan29546 commented on Nov 17, 2025

    @linhvovan29546
    Contributor

    can you fill out the bugzero checklist and confirm whether this needs a regression test?

    @brianlee-expensify This is a refactor task, so I don’t think we need the checklist here.

    also note that you're assigned the 2nd bulletpoint in the #71062 (comment) when you should be on the 3rd bulletpoint

    I’m the reviewer (C+), so the second bullet is correct.

    I’ve also reviewed two PRs separate, so I would like to request adjustment to the payment accordingly for myself, since this took more time to review than expected:
    Replace getValidReports by enrichReports and introduce optionsOrderAnddGroupBy
    Refactor provided component to use useSearchSelector hook and remove unused and duplicated code

  17. brianlee-expensify commented on Nov 17, 2025

    @brianlee-expensify
    Contributor

    @linhvovan29546 thanks for clarifying! and for the adjustment, will provide an update here shortly

  18. brianlee-expensify commented on Nov 17, 2025

    @brianlee-expensify
    Contributor

    Payment Summary

    Contributor: @lorretheboy paid $250 via Upwork on the 19th (see posting)
    Contributor+: @linhvovan29546 paid $500 via Upwork (confirmed with @AndrewGable - will edit this offer when paying out on the 19th)

  19. brianlee-expensify commented on Nov 19, 2025

    @brianlee-expensify
    Contributor

    confirmed payment today for both @lorretheboy and @linhvovan29546 - closing out now

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 productionDailyKSv2ExternalAdded to denote the issue can be worked on by a contributorTask

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions