Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.48k stars 2.83k forks source link

Search - Same search query appears twice in Recent searches #51044

Open lanitochka17 opened 2 hours ago

lanitochka17 commented 2 hours ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.50-3 Reproducible in staging?: Y Reproducible in production?: N If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): applausetester+kh081006@applause.expensifail.com Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

Expected Result:

The search query made in Step 4 will only appear once after clicking on the same search query again in Step 7

Actual Result:

The search query made in Step 4 appears twice after clicking on the same search query again in Step 7

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/4721e008-4faa-4216-ab1f-2561b9dd4a03

View all open jobs on GitHub

melvin-bot[bot] commented 2 hours ago

Triggered auto assignment to @dangrous (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

melvin-bot[bot] commented 2 hours ago

💬 A slack conversation has been started in #expensify-open-source

github-actions[bot] commented 2 hours ago

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.
lanitochka17 commented 2 hours ago

We think that this bug might be related to #wave-control

luacmartins commented 2 hours ago

Interesting, the Onyx data is different from what's being displayed Screenshot 2024-10-17 at 11 22 32 AM

jaydamani commented 1 hour ago

Proposal

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

Same search query appears twice in Recent searches

What is the root cause of that problem?

When we search again, new entry is added to nvp_RecentSearches

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

Add logic to remove duplicate queries and keep only most recent one in below line.

https://github.com/Expensify/App/blob/2aae716653057688ea752e0d47903c11db9d03fc/src/components/Search/SearchRouter/SearchRouter.tsx#L55

jaydamani commented 1 hour ago

Interesting, the Onyx data is different from what's being displayed Screenshot 2024-10-17 at 11 22 32 AM

FYI, It happens because we don't use sort related properties when making the search header in below code. So, we essentially ignore sort by, sort order and policy id from the query.

https://github.com/Expensify/App/blob/91c6e0c510a032bca87e529c82cb3c28d8755ab4/src/libs/SearchUtils.ts#L812-L815

dangrous commented 1 hour ago

@luacmartins do you want to take this one since you know the search stuff well?