Skip to content

[HOLD for payment 2024-04-05] [$500] Category - Recent and All sections appear when selected category is invalid with <8 categories #37766

Closed

Description

@lanitochka17

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: 1.4.47-2
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4381056
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:

  • User is an employee of Collect workspace
  • The Collect workspace has 8 categories
  1. [Employee] Go to workspace chat
  2. [Employee] Create two manual requests, with Merchant A and Merchant B
  3. [Admin] On Old Dot. disable Merchant A so that now there is less than 8 categories
  4. [Employee] Go to the details page of request that has Merchant A
  5. [Employee] Click Category

Expected Result:

Since there is now less than 8 categories, the category list will not show search field, Recent and All sections

Actual Result:

Although there is less than 8 categories, the category list still shows Recent and All sections
When employee selects another category and reopens the list, the sections are gone

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

Add any screenshot/video evidence

Bug6402931_1709651644885.20240305_180506.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c18a41a21d81a420
  • Upwork Job ID: 1767300069769654272
  • Last Price Increase: 2024-03-11

Activity

  1. github-actions commented on Mar 5, 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.
  2. melvin-bot commented on Mar 5, 2024

    @melvin-bot

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

  3. lanitochka17 commented on Mar 5, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #wave6
    CC @greg-schroeder

  4. lanitochka17 commented on Mar 5, 2024

    @lanitochka17
    Author

    @luacmartins 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

  5. Krishna2323 commented on Mar 5, 2024

    @Krishna2323
    Contributor

    Proposal

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

    Category - Recent and All sections appear when selected category is invalid with <8 categories

    What is the root cause of that problem?

    We include selectedOptions as enabled option and based on that we check for numberOfVisibleCategories < CONST.CATEGORY_LIST_THRESHOLD.

    const selectedOptionNames = selectedOptions.map((selectedOption) => selectedOption.name);
    const enabledAndSelectedCategories = [...selectedOptions, ...sortedCategories.filter((category) => category.enabled && !selectedOptionNames.includes(category.name))];
    const numberOfVisibleCategories = enabledAndSelectedCategories.length;
    if (numberOfVisibleCategories < CONST.CATEGORY_LIST_THRESHOLD) {
    categorySections.push({
    // "All" section when items amount less than the threshold
    title: '',
    shouldShow: false,
    indexOffset,
    data: getCategoryOptionTree(enabledAndSelectedCategories),
    });

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

    We should subtract number of disabled selected option from numberOfVisibleCategories to get the correct value.

        const selectedOptionNames = selectedOptions.map((selectedOption) => selectedOption.name);
        const disabledSelectedOptionLength = selectedOptions.filter((selectedOption) => !selectedOption.enabled).length;
        const enabledAndSelectedCategories = [...selectedOptions, ...sortedCategories.filter((category) => category.enabled && !selectedOptionNames.includes(category.name))];
        const numberOfVisibleCategories = enabledAndSelectedCategories.length - disabledSelectedOptionLength;
    
        if (numberOfVisibleCategories < CONST.CATEGORY_LIST_THRESHOLD) {
            categorySections.push({
                // "All" section when items amount less than the threshold
                title: '',
                shouldShow: false,
                indexOffset,
                data: getCategoryOptionTree(enabledAndSelectedCategories),
            });
    
            return categorySections;
        }

    We might need to do the same for Tags or other similar fields.

    Result

    Alternative

    We can use numberOfCategories and we can remove numberOfVisibleCategories as it will be redundant.

    const numberOfCategories = enabledCategories.length;

  6. luacmartins commented on Mar 5, 2024

    @luacmartins
    Contributor

    I'm unable to reproduce this issue on staging. See video below:

    Screen.Recording.2024-03-05.at.1.58.39.PM.mov
  7. added
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Mar 5, 2024
  8. 54 remaining items

  9. Krishna2323 commented on Apr 6, 2024

    @Krishna2323
    Contributor

    @johncschuster, the summary says I have been paid, but I haven't received the payment yet. Just pointing this out in case there is any confusion. I just accepted the new offer.

  10. Krishna2323 commented on Apr 9, 2024

    @Krishna2323
    Contributor

    @johncschuster, bump for payments 🙇🏻

  11. melvin-bot commented on Apr 12, 2024

    @melvin-bot

    @johncschuster, @luacmartins, @allroundexperts, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  12. johncschuster commented on Apr 12, 2024

    @johncschuster
    Contributor

    Sorry I missed your ping, @Krishna2323! The note above wasn't meant to say you were already paid – it was meant to mean that the method by which you would be paid is through Upwork. I've just issued payment now! 🎉

  13. johncschuster commented on Apr 12, 2024

    @johncschuster
    Contributor

    @allroundexperts can you complete the BZ Checklist above? Thank you!

  14. allroundexperts commented on Apr 15, 2024

    @allroundexperts
    Contributor

    Checklist

    1. Fix/29901: Selected category should be in the list  #32902
    2. https://github.com/Expensify/App/pull/32902/files#r1565810749
    3. N/A
    4. A regression test would be helpful here. The steps given in the OP look good enough to me.
  15. JmillsExpensify commented on May 3, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @allroundexperts

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded 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