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

[HOLD for payment 2023-12-04] [$500] [Wave 6: Tags] In the Tag list, two tags are highlighted at the same time #30465

Closed
6 tasks done
izarutskaya opened this issue Oct 26, 2023 · 46 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Oct 26, 2023

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.3.91-0
Reproducible in staging?: Y
Reproducible in production?: Y
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:

  1. Under the administrator account, log in to OldD
  2. Enable Tag in the policy and add 7 tags
  3. Add an employee to the policy
  4. Log in to NewD under the employee's account
  5. Create an IOU with Tag
  6. Under admin in OldD, disable the selected Tag
  7. In NewD, as an employee, log in to the created IOU and enter the Tag list in the fields.
  8. Select another tag (you may need to repeat this step several times)

Expected Result:

Only one selected tag should be highlighted in the Tag list in all cases

Actual Result:

When you disable any Tag in OldD in the IOU(NewD) details in the Tag section, two fields are highlighted instead of the one selected.

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

Android: Native
Bug6252293_1698347957221.RPReplay_Final1698318329.mp4
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0193a0141499ea9bba
  • Upwork Job ID: 1717640846589759488
  • Last Price Increase: 2023-11-02
  • Automatic offers:
    • alitoshmatov | Reviewer | 27689487
    • tienifr | Contributor | 27689489
@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

Triggered auto assignment to @kevinksullivan (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot changed the title IOU - In the Tag list, two tags are highlighted at the same time [$500] IOU - In the Tag list, two tags are highlighted at the same time Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

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

@tienifr
Copy link
Contributor

tienifr commented Oct 27, 2023

Proposal

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

When you disable any Tag in OldD in the IOU(NewD) details in the Tag section, two fields are highlighted instead of the one selected.

What is the root cause of that problem?

In here, when calculating the initialFocusedIndex, we're getting the index of the selected tag in the original list, let's say the index is 4. The tag at index 3, is the tag that was selected then disabled, then we select the tag at index 4.

However, we're actually displaying the only the enabled tags, so in this case the index of the selected tag in the list that is shown is 3 (because the 3rd index tag is disabled so it's not contained in the list).

So 2 tags will be highlighted:

  • The selected tag at index 3
  • And the tag at index 4 that corresponds to the initialFocusedIndex calculated here

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

We need to make sure when getting the initialFocusedIndex, we get it from the list that will actually be shown in the OptionsSelector, we need to filter out the disabled tags here before calculating it.

We can assign the enabled tags to a variable

 const enabledTags = _.filter(policyTagList, (policyTag) => policyTag.enabled);

And use it here to calculate the initialFocusedIndex, and here when getting the count as well.

What alternative solutions did you explore? (Optional)

We can additionally modify the UX to still show the "disabled but selected" tag. So that tag will still appear in the list. The logic above is still needed to ensure that the list of tags shown to the user and the list used to calculate initialFocusedIndex is always the same.

@melvin-bot melvin-bot bot added the Overdue label Oct 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@kevinksullivan, @alitoshmatov Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@alitoshmatov
Copy link
Contributor

Reviewing

@melvin-bot melvin-bot bot removed the Overdue label Oct 30, 2023
@alitoshmatov
Copy link
Contributor

@kevinksullivan @tienifr Can you help me test this, I created workspace in old dot and added some tags to this workspaces. I also invited employee account. When I login into employee account in new dot I am only seeing #announce room. And I cannot create money request with tags

@melvin-bot melvin-bot bot added the Overdue label Nov 2, 2023
Copy link

melvin-bot bot commented Nov 2, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Nov 3, 2023

@kevinksullivan, @alitoshmatov Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@eh2077
Copy link
Contributor

eh2077 commented Nov 3, 2023

Proposal

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

IOU - In the Tag list, two tags are highlighted at the same time

What is the root cause of that problem?

The root cause of this issue is that the initialFocusedIndex is incorrect when there're disabled tags in policyTagList, see

const initialFocusedIndex = useMemo(() => {
if (isTagsCountBelowThreshold && selectedOptions.length > 0) {
return _.chain(policyTagList)
.values()
.findIndex((policyTag) => policyTag.name === selectedOptions[0].name, true)
.value();
}
return 0;
}, [policyTagList, selectedOptions, isTagsCountBelowThreshold]);

As the sections only includes enabled = true tags, so if there're diabled tags in policyTagList, the initialFocusedIndex can be wrong for the selected tag option.

The initialFocusedIndex is calculated depending on [policyTagList, selectedOptions, isTagsCountBelowThreshold], which is not including the effect of searchValue. So, there'll be issue when searching tags as well.

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

Based on the RCA above, to ensure initialFocusedIndex is correctly calculated, we should consider following two cases

  1. There're disabled tags
  2. When search tags

To fix the issue and achieve consistent implementation, we can use the same way to calculate initialFocusedIndex as CategoryPicker does. We can calculate initialFocusedIndex based on sections and then we can handle the two cases mentioned above together.

We can add

    const initialFocusedIndex = useMemo(() => {
        let tagInitialFocusedIndex = 0;

        if (!_.isEmpty(searchValue) || isTagsCountBelowThreshold) {
            const index = _.findIndex(lodashGet(sections, '[0].data', []), (tag) => tag.searchText === selectedTag);

            tagInitialFocusedIndex = index === -1 ? 0 : index;
        }

        return tagInitialFocusedIndex;
    }, [selectedTag, searchValue, isTagsCountBelowThreshold, sections]);

below this line.

Click to see demo video
0-web.mp4

What alternative solutions did you explore? (Optional)

N/A

@eh2077
Copy link
Contributor

eh2077 commented Nov 3, 2023

@alitoshmatov We can use mocked data and modify Permissions.ts to enable selecting tags. We can mock data from console, like

Onyx.set('policyTags_53F926B8E663366D', {
            Department: {
                name: 'Department',
                tags: {
                    Accounting: {
                        name: 'Accounting',
                        enabled: true,
                    },
                    Design: {
                        name: 'Design',
                        enabled: true,
                    },
                    Engineering: {
                        name: 'Engineering',
                        enabled: true,
                    },
                    HR: {
                        name: 'HR',
                        enabled: true,
                    },
                    Infra: {
                        name: 'Infra',
                        enabled: true,
                    },
                    Legal: {
                        name: 'Legal',
                        enabled: true,
                    },
                    Marketing: {
                        name: 'Marketing',
                        enabled: true,
                    },
                    Ops: {
                        name: 'Ops',
                        enabled: true,
                    },
                    Sales: {
                        name: 'Sales',
                        enabled: true,
                    },
                },
            },
        });

See also #28151 and #26954

Copy link

melvin-bot bot commented Nov 7, 2023

@kevinksullivan, @alitoshmatov 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@alitoshmatov
Copy link
Contributor

alitoshmatov commented Nov 7, 2023

@tienifr 's proposals points out correct RCA and solution looks good and straightforward.

@tylerkaraszewski Can you confirm that disabled tags should not be shown even if they were selected tags, since it might confuse user.

C+ reviewed 🎀 👀 🎀

Copy link

melvin-bot bot commented Nov 7, 2023

Triggered auto assignment to @tylerkaraszewski, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@eh2077
Copy link
Contributor

eh2077 commented Nov 8, 2023

@alitoshmatov Thanks for reviewing proposals.

But I think my proposal to use same method as CategoryPicker is the better solution. The selected proposal will have two highlighted tags in search mode. When searching tags, there should be only one highlight tag
image

Looking forward to your feedback before assignment, thanks!

cc @tylerkaraszewski

@alitoshmatov
Copy link
Contributor

@eh2077 You are right, I didn't notice issue in when searching tags at the first time. Now I get it what is wrong. Your proposal makes sense and consistent with category picker.

@tylerkaraszewski I think @eh2077 proposal is the better solution here.

C+ reviewed 🎀 👀 🎀

Copy link

melvin-bot bot commented Nov 8, 2023

Current assignee @tylerkaraszewski is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

Copy link

melvin-bot bot commented Nov 15, 2023

📣 @tienifr 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 17, 2023
@tienifr
Copy link
Contributor

tienifr commented Nov 17, 2023

PR ready for review #31475.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 27, 2023
@melvin-bot melvin-bot bot changed the title [$500] [Wave 6: Tags] In the Tag list, two tags are highlighted at the same time [HOLD for payment 2023-12-04] [$500] [Wave 6: Tags] In the Tag list, two tags are highlighted at the same time Nov 27, 2023
Copy link

melvin-bot bot commented Nov 27, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 27, 2023
Copy link

melvin-bot bot commented Nov 27, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.3-11 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-12-04. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Nov 27, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@alitoshmatov] The PR that introduced the bug has been identified. Link to the PR:
  • [@alitoshmatov] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@alitoshmatov] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@alitoshmatov] Determine if we should create a regression test for this bug.
  • [@alitoshmatov] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@alitoshmatov
Copy link
Contributor

[@alitoshmatov] The PR that introduced the bug has been identified. Link to the PR: #27765
[@alitoshmatov] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: #27765 (comment)
[@alitoshmatov] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: No discussion needed
[@alitoshmatov] Determine if we should create a regression test for this bug. No regression test needed

@melvin-bot melvin-bot bot removed the Overdue label Dec 6, 2023
@alitoshmatov
Copy link
Contributor

Looks like we are ready to process the payment

@melvin-bot melvin-bot bot added the Overdue label Dec 8, 2023
Copy link

melvin-bot bot commented Dec 11, 2023

@tylerkaraszewski, @kevinksullivan, @alitoshmatov, @tienifr Huh... This is 4 days overdue. Who can take care of this?

@kevinksullivan
Copy link
Contributor

All set with payments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Development

No branches or pull requests

8 participants