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.57k stars 2.91k forks source link

[$250] Search - Search loads infinitely when search query contains type:chat and category query #52907

Open IuliiaHerets opened 16 hours ago

IuliiaHerets commented 16 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.65-1 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): applausetester+kh0811007@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Click search router icon.
  3. Enter the following query: type:chat in: category:car
  4. Hit Enter.

Expected Result:

Search will not load infinitely.

Actual Result:

Search loads infinitely.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/14013d8a-7a42-482d-9a1f-6cee8ab021e1

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021859790661845309370
  • Upwork Job ID: 1859790661845309370
  • Last Price Increase: 2024-11-22
Issue OwnerCurrent Issue Owner: @alitoshmatov
melvin-bot[bot] commented 16 hours ago

Triggered auto assignment to @Christinadobrzyn (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.

daledah commented 15 hours ago

Edited by proposal-police: This proposal was edited at 2024-11-21T21:22:56Z.

Proposal

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

Search loads infinitely.

What is the root cause of that problem?

The API Search with the above query returns error

Screenshot 2024-11-21 at 21 21 53

When Search API fails, we just update the loading to false

https://github.com/Expensify/App/blob/4c44827398f884af626872c33f64dd358d19eff4/src/libs/actions/Search.ts#L45

that make the condition shouldShowLoadingState is still false

https://github.com/Expensify/App/blob/4c44827398f884af626872c33f64dd358d19eff4/src/components/Search/index.tsx#L190-L195

so we can see the loading state

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

Solution 1: Add failure data within error in

https://github.com/Expensify/App/blob/4c44827398f884af626872c33f64dd358d19eff4/src/libs/actions/Search.ts#L51

then in Search.tsx, detect if error is in searchResults, we will show the error message

Solution 2: Add failure data within data: [], status, and type

    const failureData = [{
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`,
            value: {
                data: [],
                search: {
                    status,
                    type
                }
            },
    }]

then the empty state will be shown

What alternative solutions did you explore? (Optional)

NA

Christinadobrzyn commented 3 hours ago

I think this might have to do with how type:chat in:<any chat> category:car is being read? Here's what is showing under keyword, I think this is supposed to be 'chat'?

Snagit 2021 2024-11-22 10 46 13
melvin-bot[bot] commented 3 hours ago

Job added to Upwork: https://www.upwork.com/jobs/~021859790661845309370

melvin-bot[bot] commented 3 hours ago

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