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

[PAID] [Search v2.5] - Category field is still present after deleting all the categories #52362

Closed
3 of 8 tasks
IuliiaHerets opened this issue Nov 12, 2024 · 35 comments
Closed
3 of 8 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Nov 12, 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.60-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: #52102
Email or phone of affected tester (no customers): applausetester+290324@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Log in with a new account.
  3. Create a new workspace.
  4. Go to workspace settings > More features.
  5. Enable Tags.
  6. Go to Tags and add some tags.
  7. Go to Search > Filters.
  8. Note that Category and Tag fields are present.
  9. Go back to workspace settings.
  10. Delete all categories and tags.
  11. Go to Search > Filters.

Expected Result:

Both Category and Tag fields will not be present because there are no categories and tags.

Actual Result:

Category field is still present after deleting all the categories, while Tag field is not present which is expected.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6661800_1731356979898.20241112_042538.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @strepanier03
@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment Bug Something is broken. Auto assigns a BugZero manager. labels Nov 12, 2024
Copy link

melvin-bot bot commented Nov 12, 2024

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

Copy link

melvin-bot bot commented Nov 12, 2024

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

@melvin-bot melvin-bot bot added the Daily KSv2 label Nov 12, 2024
Copy link

melvin-bot bot commented Nov 12, 2024

💬 A slack conversation has been started in #expensify-open-source

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Nov 12, 2024
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.

@NJ-2020
Copy link
Contributor

NJ-2020 commented Nov 12, 2024

Edited by proposal-police: This proposal was edited at 2024-11-12 10:11:34 UTC.

Proposal

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

Search - Category field is still present after deleting all the categories

What is the root cause of that problem?

Offending PR: #52102
We will show the category menu if the policy category id exist in nonPersonalPolicyCategoryIds

const nonPersonalPolicyCategoryIds = Object.values(policies)
.filter((policy): policy is NonNullable<Policy> => !!(policy && policy.type !== CONST.POLICY.TYPE.PERSONAL))
.map((policy) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policy.id}`);
const nonPersonalPolicyCategoryCount = Object.keys(allPolicyCategories).filter((policyCategoryId) => nonPersonalPolicyCategoryIds.includes(policyCategoryId)).length;
const shouldDisplayCategoryFilter = nonPersonalPolicyCategoryCount !== 0 || !!singlePolicyCategories;

When we create new workspace and enable the categories feature, the category menu item will show because the policy category id is exist inside nonPersonalPolicyCategoryIds
const nonPersonalPolicyCategoryCount = Object.keys(allPolicyCategories).filter((policyCategoryId) => nonPersonalPolicyCategoryIds.includes(policyCategoryId)).length;

But when we delete all the categories, the policy category id still exists in this allPolicyCategories with empty object value and when when we check if the policy category is exist inside nonPersonalPolicyCategoryIds it will return true which cause this issue
const nonPersonalPolicyCategoryCount = Object.keys(allPolicyCategories).filter((policyCategoryId) => nonPersonalPolicyCategoryIds.includes(policyCategoryId)).length;

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

Inside allPolicyCategories we should filter out if the value is empty object

const filteredPoliciyCategories = useMemo(() => Object.values(allPolicyCategories ?? {}).filter((policyCategory) => !isEmptyObject(policyCategory)), [allPolicyCategories])

OR

const nonPersonalPolicyCategoryCount = Object.keys(allPolicyCategories).filter(
    (policyCategoryId) => nonPersonalPolicyCategoryIds.includes(policyCategoryId) && !isEmptyObject(allPolicyCategories[policyCategoryId]),
).length;

const shouldDisplayCategoryFilter = nonPersonalPolicyCategoryCount !== 0 || !!singlePolicyCategories;

What alternative solutions did you explore? (Optional)

@MariaHCD
Copy link
Contributor

Since this is a bug from #52102 and we're still in the regression period, the original PR author will be handling the fix for this.

cc: @Kicu @fedirjh @luacmartins

@Kicu
Copy link
Contributor

Kicu commented Nov 12, 2024

will write a comment here a bit later

@Kicu
Copy link
Contributor

Kicu commented Nov 12, 2024

Please assign me, I will provide a fix for this.
That being said I don't think this is necessarily a deploy blocker, maybe @luacmartins you can verify

@luacmartins
Copy link
Contributor

Yea, this is not a blocker. Assigning it to you @Kicu

@luacmartins luacmartins added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Nov 12, 2024
@luacmartins luacmartins changed the title Search - Category field is still present after deleting all the categories [Search v2.5] - Category field is still present after deleting all the categories Nov 12, 2024
@MariaHCD MariaHCD removed their assignment Nov 13, 2024
@SzymczakJ
Copy link
Contributor

@Kicu asked me to take a look at it, I think that solution that @NJ-2020 proposed is good(also tested it) and we should let him open a PR with it 😄
WDYT @luacmartins

@luacmartins
Copy link
Contributor

That works for me

@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Nov 22, 2024
@melvin-bot melvin-bot bot changed the title [Search v2.5] - Category field is still present after deleting all the categories [HOLD for payment 2024-11-29] [Search v2.5] - Category field is still present after deleting all the categories Nov 22, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 22, 2024
Copy link

melvin-bot bot commented Nov 22, 2024

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

Copy link

melvin-bot bot commented Nov 22, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.65-5 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 2024-11-29. 🎊

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

  • @Kicu does not require payment (Contractor)
  • @NJ-2020 requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Nov 22, 2024

@luacmartins @strepanier03 @Kicu / @NJ-2020 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Nov 29, 2024
Copy link

melvin-bot bot commented Nov 29, 2024

Payment Summary

Upwork Job

  • Contributor: @Kicu is from an agency-contributor and not due payment
  • ROLE: @NJ-2020 paid $250 via Upwork (Job)

BugZero Checklist (@strepanier03)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

Copy link

melvin-bot bot commented Dec 2, 2024

@Kicu, @strepanier03, @luacmartins, @NJ-2020 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@strepanier03 strepanier03 changed the title [HOLD for payment 2024-11-29] [Search v2.5] - Category field is still present after deleting all the categories [Payment 2024-11-29] [Search v2.5] - Category field is still present after deleting all the categories Dec 3, 2024
@strepanier03
Copy link
Contributor

Working on this now, the "HOLD" in the title had it hidden from me yesterday and I didn't see it. Sorry for the delay.

@melvin-bot melvin-bot bot removed the Overdue label Dec 3, 2024
@strepanier03
Copy link
Contributor

@NJ-2020 - Can you please share a link to your profile in Upwork? I'm unable to find it to send you an offer. Thanks!

@strepanier03
Copy link
Contributor

@Kicu - I think you're responsible for the checklist, can you take care of that as well?

@NJ-2020
Copy link
Contributor

NJ-2020 commented Dec 3, 2024

@strepanier03 Sure here's my upwork profile: https://www.upwork.com/freelancers/~01ff73ff788ecf5f2e

@Kicu
Copy link
Contributor

Kicu commented Dec 4, 2024

@strepanier03 I work for SWM, an expert agency as a contractor and I'm also not a C+.
So are you sure that I should take care of the checklist? 😅 I think this is not something we are responsible for.

@strepanier03
Copy link
Contributor

Hmmm, I thought you were the reviewer here; sorry about that, @Kicu. This comment had me a bit turned around I think. I'll figure out who is responsible for it.

@strepanier03
Copy link
Contributor

Hmmm, looks like @Ollyws reviewed the PR.

@Ollyws
Copy link
Contributor

Ollyws commented Dec 5, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on both staging and production
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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: https://github.com/Expensify/App/pull/52102/files#r1871922833

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal Template
  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Precondition:

Test:

1. Sign in with new account
2. Create a new workspace
3. Go to workspace settings > categories
4. Delete all categories
5. Go to Search page > Filters
6. Make sure the Category menu is not presents in the Filters menu page

Do we agree 👍 or 👎

@Ollyws
Copy link
Contributor

Ollyws commented Dec 5, 2024

@strepanier03 Could you post an updated payment summary and I'll request payment in ND, thanks!

@strepanier03
Copy link
Contributor

Payment summary

@strepanier03
Copy link
Contributor

updated payment summary above @Ollyws, feel free to request. @NJ-2020 I sent you the offer, I'll check it in a few hours to see if I can pay it out.

@Ollyws
Copy link
Contributor

Ollyws commented Dec 5, 2024

Requested in ND.

@NJ-2020
Copy link
Contributor

NJ-2020 commented Dec 5, 2024

@strepanier03 Done accepted, Thanks

@strepanier03
Copy link
Contributor

I paid and closed the contract for @NJ-2020 and I see that @Ollyws has requested payment.

Closing this now.

@strepanier03 strepanier03 changed the title [Payment 2024-11-29] [Search v2.5] - Category field is still present after deleting all the categories [PAID] [Search v2.5] - Category field is still present after deleting all the categories Dec 6, 2024
@garrettmknight
Copy link
Contributor

$250 approved for @Ollyws

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 Engineering
Projects
None yet
Development

No branches or pull requests

10 participants