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 2024-10-10] [$250] Category rules - Approver field is blank for a moment after editing category name #49293

Closed
5 tasks done
IuliiaHerets opened this issue Sep 16, 2024 · 24 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

@IuliiaHerets
Copy link

IuliiaHerets commented Sep 16, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.35-0
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • Rules and Workflows are enabled.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Categories.
  3. Click on any category.
  4. Click Approver.
  5. Select any user.
  6. Click Name.
  7. Edit the name.

Expected Result:

Approver field will not go blank after editing category name.

Actual Result:

Approver field is blank for a moment after editing category name.

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • [x ] iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6604525_1726418206489.20240916_003344.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021837011004719364383
  • Upwork Job ID: 1837011004719364383
  • Last Price Increase: 2024-09-20
  • Automatic offers:
    • FitseTLT | Contributor | 104131224
Issue OwnerCurrent Issue Owner: @stephanieelliott
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 16, 2024
Copy link

melvin-bot bot commented Sep 16, 2024

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

@IuliiaHerets
Copy link
Author

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

@FitseTLT
Copy link
Contributor

FitseTLT commented Sep 16, 2024

Edited by proposal-police: This proposal was edited at 2024-09-16 19:47:51 UTC.

Proposal

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

Category rules - Approver field is blank for a moment after editing category name

What is the root cause of that problem?

We use category name to get the approver here

const categoryApprover = CategoryUtils.getCategoryApprover(policy?.rules?.approvalRules ?? [], categoryName);

but the policy rule takes time to get updated with the new category name

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

We can use previous category name to get a fallback in case the approver with current category name doesn't exist

const previousCategoryName = usePrevious(categoryName);

    const approverText = useMemo(() => {
        const categoryApprover = CategoryUtils.getCategoryApprover(policy?.rules?.approvalRules ?? [], categoryName);
        const prevApprover = CategoryUtils.getCategoryApprover(policy?.rules?.approvalRules ?? [], previousCategoryName);
        return categoryApprover ?? prevApprover ?? '';
    }, [categoryName, policy?.rules?.approvalRules]);

We also have an option to use previousCategoryName policyCategories to achieve the same similar to what we did here

const prev = Object.values(policyCategories ?? {}).find((category) => category.name === categoryName);
        const prevApprover = CategoryUtils.getCategoryApprover(policy?.rules?.approvalRules ?? [], prev?.previousCategoryName);
        return categoryApprover ?? prevApprover ?? '';

BTW similar problem exists for default tax rate which depends on policy?.rules?.expenseRules here so similar fix can be done for it too.

What alternative solutions did you explore? (Optional)

The other option we have is update policy?.rules?.approvalRules optimistically in Category.renamePolicyCategory on category name change. We can iterate on the approvalRules and when we find applyWhen with value prop same as the oldname of the category we change that value with the new category name (we will also optimistically update policy?.rules?.expenseRules for the problem regarding default tax rate)

@FitseTLT
Copy link
Contributor

Updated

@melvin-bot melvin-bot bot added the Overdue label Sep 19, 2024
@stephanieelliott stephanieelliott added the External Added to denote the issue can be worked on by a contributor label Sep 20, 2024
@melvin-bot melvin-bot bot changed the title Category rules - Approver field is blank for a moment after editing category name [$250] Category rules - Approver field is blank for a moment after editing category name Sep 20, 2024
Copy link

melvin-bot bot commented Sep 20, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 20, 2024
Copy link

melvin-bot bot commented Sep 20, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Sep 20, 2024
Copy link

melvin-bot bot commented Sep 23, 2024

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

@stephanieelliott
Copy link
Contributor

Hey @thesahindia can you please review this proposal?

@thesahindia
Copy link
Member

@FitseTLT's proposal looks good to me!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Sep 24, 2024

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

@stitesExpensify
Copy link
Contributor

@thesahindia do you have one of the 3 solutions presented by @FitseTLT that you prefer?

@thesahindia
Copy link
Member

@thesahindia do you have one of the 3 solutions presented by @FitseTLT that you prefer?

The first two solutions look good to me. We can go with either of them, I would prefer the second one

@stitesExpensify
Copy link
Contributor

Great, let's go with that @FitseTLT

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 25, 2024
Copy link

melvin-bot bot commented Sep 25, 2024

📣 @FitseTLT 🎉 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 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Sep 27, 2024
@melvin-bot melvin-bot bot changed the title [$250] Category rules - Approver field is blank for a moment after editing category name [HOLD for payment 2024-10-10] [$250] Category rules - Approver field is blank for a moment after editing category name Oct 3, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 3, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.43-6 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-10-10. 🎊

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

Copy link

melvin-bot bot commented Oct 3, 2024

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:

  • [@thesahindia] The PR that introduced the bug has been identified. Link to the PR:
  • [@thesahindia] 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:
  • [@thesahindia] 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:
  • [@thesahindia] Determine if we should create a regression test for this bug.
  • [@thesahindia] 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.
  • [@stephanieelliott] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 9, 2024
@stephanieelliott
Copy link
Contributor

Hey @thesahindia can you complete the BugZero checklist please?

@stephanieelliott
Copy link
Contributor

Summarizing payment on this issue:

  • Contributor: @FitseTLT $250 via Upwork - PAID
  • Contributor+: @thesahindia $250 via ND payments - please request!

Upwork job is here: https://www.upwork.com/jobs/~021837011004719364383

@melvin-bot melvin-bot bot added the Overdue label Oct 14, 2024
Copy link

melvin-bot bot commented Oct 14, 2024

@stephanieelliott, @FitseTLT, @stitesExpensify, @thesahindia Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@stephanieelliott
Copy link
Contributor

Hey @thesahindia can you complete the BugZero checklist please?

^^ bump @thesahindia

@melvin-bot melvin-bot bot removed the Overdue label Oct 14, 2024
@thesahindia
Copy link
Member

Seems like it was an issue in the implementation.

Here are the steps for the test case:

Precondition: Taxes, Rules and Workflows are enabled.

  1. Go to workspace settings > Categories
  2. Select a category
  3. Click "Default tax rate"
  4. Choose any tax rate that differs from the default value
  5. Click "Approver"
  6. Choose a different user
  7. Click "Name"
  8. Change the name of the category > Save
  9. Verify that the default tax rate doesn't change
  10. Verify that the approver doesn't change

@stephanieelliott
Copy link
Contributor

Thanks! Test rail case here: https://github.com/Expensify/Expensify/issues/436519

@garrettmknight
Copy link
Contributor

$250 paid for @thesahindia

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
Status: Done
Development

No branches or pull requests

6 participants