Skip to content

[Due for payment 2025-06-11] [$250] Reducing Search API Calls in Reports Screen #61053

Closed

Description

@mountiny

Coming from this proposal.

Background:

When users open an expense report from the "Reports" tab, the application displays the detailed report information. Currently, the useSearchHighlightAndScroll hook is doing more than what its name suggests - beyond just handling UI highlighting and scrolling functions, it's also making API calls to the /Search endpoint. Hooks should ideally have single responsibilities that match their names, but this hook is currently performing data fetching operations that lie outside its intended purpose.

Problem:

When a user opens an expense report, multiple redundant calls to the /Search endpoint are triggered (by useSearchHighlightAndScroll hook), wasting network resources and impacting application performance.

Solution:
We will separate the concerns by:

  1. Refining useSearchHighlightAndScroll to handle only UI tasks (highlighting and scrolling)
  2. Creating a new useSearchPusherUpdates hook in Search/index.tsx to handle Pusher update events and make /Search API calls only when necessary

This separation will maintain functionality while reducing network overhead and improving performance.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021917145585218173680
  • Upwork Job ID: 1917145585218173680
  • Last Price Increase: 2025-06-12
Issue OwnerCurrent Issue Owner: @JmillsExpensify / @Christinadobrzyn

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 29, 2025
  2. changed the title [-]Reducing Search API Calls in Reports Screen[/-] [+][$250] Reducing Search API Calls in Reports Screen[/+] on Apr 29, 2025
  3. melvin-bot commented on Apr 29, 2025

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

    @melvin-bot

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

  6. melvin-bot commented on Apr 29, 2025

    @melvin-bot

    Current assignee @mountiny is eligible for the AutoAssignerNewDotQuality assigner, not assigning anyone new.

  7. 86 remaining items

  8. c3024 commented on Jun 11, 2025

    @c3024
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: This is an optimization to remove redundant Search API calls. No PR is an offending PR here.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: Not critical enough to warrant a discussion.

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template

    Regression Test Proposal

    Precondition:

    • None

    Test:

    1. Open Network devtools tab.
    2. Navigate to Reports screen.
    3. Click on any item from the list (expense report). You should see that /OpenReport endpoint is called.
    4. There should be no multiple /Search calls.

    Do we agree 👍 or 👎

  9. melvin-bot commented on Jun 11, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    • Contributor: @martasudol is from an agency-contributor and not due payment
    • Reviewer: @c3024 owed $250 via NewDot

    BugZero Checklist (@JmillsExpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1917145585218173680/hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  10. JmillsExpensify commented on Jun 11, 2025

    @JmillsExpensify
    Contributor

    Payment summary: $250 to @c3024 via NewDot.

  11. Christinadobrzyn commented on Jun 11, 2025

    @Christinadobrzyn
    Contributor

    Hey @mountiny @c3024 - the payment summary in the title of this email says payment should be $125 but it looks like you requested $250. What is the amount that should be paid for this job?

  12. c3024 commented on Jun 12, 2025

    @c3024
    Contributor

    @Christinadobrzyn

    I haven't requested anything yet on ND. @JmillsExpensify just posted the payment summary. You updated the amount to $125 in the title because the PR was reverted once. This was a tricky PR, so not all regressions could be identified during the C+ review, even with careful testing. Therefore, @mountiny suggested paying the full amount of $250.

    Thanks!

  13. changed the title [-][Due for payment 2025-06-11] [$125] Reducing Search API Calls in Reports Screen[/-] [+][Due for payment 2025-06-11] [$250] Reducing Search API Calls in Reports Screen[/+] on Jun 12, 2025
  14. melvin-bot commented on Jun 12, 2025

    @melvin-bot

    Upwork job price has been updated to $250

  15. Christinadobrzyn commented on Jun 12, 2025

    @Christinadobrzyn
    Contributor

    Ah, thank you so much @c3024! I really appreciate the summary! Ok awesome, I updated the GH title to the $250.

    Payment summary here #61053 (comment)

    Regression test here - #61053 (comment)

    @c3024 please make sure to request payment via ND. TY!

  16. garrettmknight commented on Jul 2, 2025

    @garrettmknight
    Contributor

    Payment summary: $250 to @c3024 via NewDot.

  17. JmillsExpensify commented on Jul 2, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @c3024

  18. QichenZhu commented on Aug 25, 2026

    @QichenZhu
    Contributor

    We still encountered a similar issue as the fix for this issue didn't fully address the problem (see details), so we've made further fixes in PRs #98558 and #98752.

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

Metadata

Metadata

Labels

AutoAssignerNewDotQualityUsed to assign quality issues to engineersAwaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions