Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$250] [HOLD #43494][Search v1] Category field does not stay put when clicking on To title after enabling it #44198

Closed
2 of 6 tasks
m-natarajan opened this issue Jun 22, 2024 · 12 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Jun 22, 2024

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.1-0
Reproducible in staging?: y
Reproducible in production?: n
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

Action Performed:

Precondition:

  • Account has only one workspace.
  • Categories, Tags and Taxes features are disabled.
  • Account has at least one p2p expense.
  1. Go to staging.new.expensify.com
  2. Go to Search.
  3. Click To title a few times.
  4. Go to workspace settings > More features.
  5. Enable Categories.
  6. Return to Search.
  7. Click To title a few times.
  8. Go to workspace settings > More features.
  9. Disable Categories.
  10. Return to Search.
  11. Click To title a few times.

Expected Result:

When Categories feature is enabled/disabled, Category title will not disappear/appear when clicking on To field.

Actual Result:

When Categories feature is enabled/disabled, Category title disappears/appears when clicking on To field.

Workaround:

unknown

Platforms:

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

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

Screenshots/Videos

Bug6521359_1719047104786.search.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012db531b3b7860fba
  • Upwork Job ID: 1805205019945269990
  • Last Price Increase: 2024-06-24
Issue OwnerCurrent Issue Owner: @parasharrajat
@m-natarajan m-natarajan added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Jun 22, 2024
Copy link

melvin-bot bot commented Jun 22, 2024

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

Copy link

melvin-bot bot commented Jun 22, 2024

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

Copy link
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.

@m-natarajan
Copy link
Author

@puneetlath FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@m-natarajan
Copy link
Author

We think that this bug might be related to #vip-vsb

@tsa321
Copy link
Contributor

tsa321 commented Jun 23, 2024

Proposal

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

Web - transaction search category column doesn't stay put when clicking on header to sort the search.

What is the root cause of that problem?

In here:

const searchResults = currentSearchResults?.data ? currentSearchResults : lastSearchResultsRef.current;

We set searchResults as lastSearchResult when Onyx data isn't available. The search metadata, {searchResults?.search}, is stored in the search field, which includes columnsToShow. When the user sorts the search list using a different header, the search result will be retrieved from the server, and the searchResult will use the stored snapshot of the hash query key. Consequently, columnsToShow will reflect the value stored in the snapshot with the hash key. When the user toggles the category feature on or off, the Onyx data for each hash still retains the previous columnsToShow from before the toggle. This causes the category column to hide and then show up again when the search result is received from the server.

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

We could use useRef of columnsToShow and assign it the value from the first serchResult.search.columnToShow when user open search transaction page and don't change the value.

Then set searchResults?.search?.columnsToShow with the value of columnsToShowRef.current. The searchResults?.search then will be be used in SearchTableHeader metadata.

The code could be:

    const isAlreadyLoading = useRef(false);
    const columnsToShowRef = useRef(null);
    useEffect(() => {
        if (currentSearchResults?.search?.isLoading) {
            isAlreadyLoading.current = true;
        }

       if (!columnsToShowRef.current && currentSearchResults?.search?.isLoading === false && isAlreadyLoading.current) {
            columnsToShowRef.current = {
                ...currentSearchResults.search.columnsToShow
            };
        }
    }, [currentSearchResults?.search?.isLoading]);
.....
if (columnsToShowRef.current) {
       searchResults.search.columnsToShow = columnsToShowRef.current;
}

Alternative solution:

We could pass columnsToShow from SearchPage to Search component.

@mountiny mountiny added External Added to denote the issue can be worked on by a contributor and removed DeployBlocker Indicates it should block deploying the API labels Jun 24, 2024
@melvin-bot melvin-bot bot changed the title Web - Search - Category field does not stay put when clicking on To title after enabling it [$250] Web - Search - Category field does not stay put when clicking on To title after enabling it Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 24, 2024
@mountiny mountiny added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors labels Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

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

@mountiny
Copy link
Contributor

I think we can demote this one, its quite an edge case and it does not block user

@parasharrajat
Copy link
Member

I will review it in the morning.

@luacmartins
Copy link
Contributor

FWIW I think this issue will fix it - #43494

@luacmartins luacmartins changed the title [$250] Web - Search - Category field does not stay put when clicking on To title after enabling it [$250] [Search v1] Category field does not stay put when clicking on To title after enabling it Jun 25, 2024
@luacmartins luacmartins changed the title [$250] [Search v1] Category field does not stay put when clicking on To title after enabling it [$250] [HOLD #43494][Search v1] Category field does not stay put when clicking on To title after enabling it Jun 25, 2024
@kevinksullivan
Copy link
Contributor

That ^ Pr is on prod. @m-natarajan reopen if you see an issue like this again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants