Skip to content

Search - Second saved search name order with an edited filter differs #49223

Closed

Description

@IuliiaHerets

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.35-0
Reproducible in staging?: Y
Reproducible in production?: N/A - new feature, doesn't exist in prod
Issue was found when executing this PR: #48566
Issue reported by: Applause Internal Team

Action Performed:

  1. Log in with a Gmail account with a lot of expenses
  2. Click on "Search"
  3. Click on "Filters"
  4. Click on "Merchant"
  5. Type "a" and click on the "Save" button
  6. Click on "Save search"
  7. Click on "Filters"
  8. Click on "Merchant"
  9. Replace "a" with "b"
  10. Click on "Save search"

Expected Result:

The name order should be "type status merchant" to match the original one.

Actual Result:

Second saved search name order with an edited filter differs from the original one. It's displayed as: "merchant type status".

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6604102_1726380933961.bandicam_2024-09-15_08-05-46-169.mp4

Bug6604102_1726380933968!Capture

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 15, 2024
  2. melvin-bot commented on Sep 15, 2024

    @melvin-bot

    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.

  3. melvin-bot commented on Sep 15, 2024

    @melvin-bot

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

  4. github-actions commented on Sep 15, 2024

    @github-actions
    Contributor

    👋 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.
  5. IuliiaHerets commented on Sep 15, 2024

    @IuliiaHerets
    Author

    We think that this bug might be related to #wave-collect - Release 1

  6. huult commented on Sep 15, 2024

    @huult
    Contributor

    Proposal

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

    Second saved search name order with an edited filter differs

    What is the root cause of that problem?

    The values of TYPE and STATUS are set after the remaining values, such as Merchant.

    App/src/libs/SearchUtils.ts

    Lines 674 to 675 in 0c618ac

    filtersForm[FILTER_KEYS.TYPE] = queryJSON.type;
    filtersForm[FILTER_KEYS.STATUS] = queryJSON.status;

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

    We should set the values of TYPE and STATUS before the remaining filter keys.

    Move filtersForm[FILTER_KEYS.TYPE] = queryJSON.type; and filtersForm[FILTER_KEYS.STATUS] = queryJSON.status; from L674 to L635 so that TYPE and STATUS are set before the remaining keys

    What alternative solutions did you explore? (Optional)

    we will update the filter name and input query before saving the search

    // .src/libs/actions/Search.ts#L55
    function saveSearch({queryJSON, name}: {queryJSON: SearchQueryJSON; name?: string}) {
    -  const saveSearchName = name ?? queryJSON?.inputQuery ?? '';
    +    let saveSearchName = '';
    +    if (name) {
    +        saveSearchName = name;
    +    } else if (queryJSON?.inputQuery) {
    +       const name = SearchUtils.getSearchHeaderTitle(queryJSON);
    +                saveSearchName = name;
    +    }
    
    -    const jsonQuery = JSON.stringify(queryJSON);
    +    const jsonQuery = JSON.stringify({...queryJSON, inputQuery: SearchUtils.getSearchHeaderTitle(queryJSON)});
    
        API.write(WRITE_COMMANDS.SAVE_SEARCH, {jsonQuery, name: saveSearchName});
    }
    
    DetailsPOC
    Screen.Recording.2024-09-15.at.23.17.30.mp4
  7. luacmartins commented on Sep 15, 2024

    @luacmartins
    Contributor

    This is not a blocker. We sort those based on the order in which they were created. We can close this for now and reopen if we decide to sort them alphabetically.

  8. huult commented on Sep 16, 2024

    @huult
    Contributor

    Note: in this ticket, if we don't update the filter name on the left side, we will have an issue with inconsistent filter names, as shown in the image below.
    Screenshot 2024-09-16 at 09 35 43

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions