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-06-13] [$250] mWeb - Tax - Saving tax name without altering displays error message #42556

Closed
1 of 6 tasks
lanitochka17 opened this issue May 23, 2024 · 28 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

@lanitochka17
Copy link

lanitochka17 commented May 23, 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: 1.4.75
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Tap on profile -- workspaces -- workspace
  3. Tap more features
  4. Toggle on taxes
  5. Navigate to workspace settings and tap taxes
  6. Tap add rate
  7. Enter a tax name and value
  8. Save it
  9. Tap on new tax rate created
  10. Tap on tax name
  11. Without altering tax name, save it
  12. Note error shown
  13. Navigate back and note error displayed under new tax rate created

Expected Result:

When user saves without altering tax name, it must not display error message
Under new tax rate created error message must not be shown

Actual Result:

When user saves without altering tax name, it displays error message " An error occurred while updating tax rate. Please try again or ask concierge for help. " Under new tax rate created error message " Duplicate tax name" is shown

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

Bug6489742_1716489237727.tax.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f750a4457ca441b3
  • Upwork Job ID: 1795375303903567872
  • Last Price Increase: 2024-05-28
  • Automatic offers:
    • rojiphil | Reviewer | 102532639
    • GandalfGwaihir | Contributor | 102532640
Issue OwnerCurrent Issue Owner: @laurenreidexpensify
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 23, 2024
@allgandalf
Copy link
Contributor

Proposal

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

Saving tax name with no edit throws error

What is the root cause of that problem?

We currently do not have any check in place to check if the new tag name is same as current tag name, we directly call renamePolicyTax function.

const submit = () => {
renamePolicyTax(policyID, taxID, name);
goBack();
};

Then when we make this request to the BE it returns error of Duplicate Name

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

We should goBack and return early if there is no change between the current tag name and new tag name, we can get the current tag name from currentTaxRate?.name:

const submit = () => {
        if(name === currentTaxRate?.name)
        {
            goBack();
            return;
        }
        renamePolicyTax(policyID, taxID, name);
        goBack();
    };

What alternative solutions did you explore? (Optional)

@allgandalf
Copy link
Contributor

@lanitochka17 , i guess automation didn't work, can you add those labels again ?

@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. and removed Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 24, 2024
Copy link

melvin-bot bot commented May 24, 2024

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

@lanitochka17
Copy link
Author

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

@cretadn22
Copy link
Contributor

cretadn22 commented May 25, 2024

Proposal

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

The API update continues to be triggered even when we update with the old value. This issue also persists on the tax value page.

What is the root cause of that problem?

const submit = () => {
renamePolicyTax(policyID, taxID, name);
goBack();
};

const submit = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_TAX_VALUE_FORM>) => {
updatePolicyTaxValue(policyID, taxID, Number(values.value));
goBack();
},

In these instances, we don't check if the updated value is similar to the old value and thus do not prevent updating.

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

We should implement the same logic as we did in the EditTagPage.

This means applying it to the Name page and Value page as well.
For the Name page, we need to trim value before checking

const taxName = name.trim();
// Do not call the API if the edited tax name is the same as the current tag name
if (currentTaxRate?.name !== taxName) {
     renamePolicyTax(policyID, taxID, taxName);
}
Keyboard.dismiss();
goBack();

For the Value page:

const submit = useCallback(
        (values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_TAX_VALUE_FORM>) => {
        // Do not call the API if the edited tax name is the same as the current tag name
        if (defaultValue !== values.value) {
            updatePolicyTaxValue(policyID, taxID, Number(values.value));
        }
        Keyboard.dismiss();
        goBack();
        },
        [goBack, policyID, taxID],
    );

We're considering adding Keyboard.dismiss(); to enhance the user experience on mobile devices

Optional: We should also address the same issue on other pages if it exists like PolicyDistanceRateEditPage

const submitRate = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.POLICY_DISTANCE_RATE_EDIT_FORM>) => {
Policy.updatePolicyDistanceRateValue(policyID, customUnit, [{...rate, rate: Number(values.rate) * CONST.POLICY.CUSTOM_UNIT_RATE_BASE_OFFSET}]);
Keyboard.dismiss();
Navigation.goBack();
};

What alternative solutions did you explore? (Optional)

NA

@allgandalf
Copy link
Contributor

allgandalf commented May 25, 2024

We're considering adding Keyboard.dismiss(); to enhance the user experience on mobile devices

Keyboard is already dismissed on Native applications @cretadn22 :)

RPReplay_Final1716615262.mp4

For the Value page:

And the value page doesn’t have a keyboard popup as it is a numpad input.

@cretadn22
Copy link
Contributor

@GandalfGwaihir, I recommend adding Keyboard.dismiss() because it aligns with our existing pattern of usage in scenarios like editing tags, categories, distance rates, and others. It's worth delving deeper to clarify why this function is necessary for consistency across our application.

@melvin-bot melvin-bot bot added the Overdue label May 27, 2024
Copy link

melvin-bot bot commented May 27, 2024

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

@laurenreidexpensify laurenreidexpensify added the External Added to denote the issue can be worked on by a contributor label May 28, 2024
@melvin-bot melvin-bot bot changed the title mWeb - Tax - Saving tax name without altering displays error message [$250] mWeb - Tax - Saving tax name without altering displays error message May 28, 2024
Copy link

melvin-bot bot commented May 28, 2024

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

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

melvin-bot bot commented May 28, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label May 28, 2024
@laurenreidexpensify
Copy link
Contributor

Calm down melvin, not overdue, just waiting for proposals and review

@laurenreidexpensify
Copy link
Contributor

@rojiphil bump for review ^^ thanks

@melvin-bot melvin-bot bot added the Overdue label May 30, 2024
@rojiphil
Copy link
Contributor

Thanks for your proposals. Both proposals have got the RCA correct.
Regarding implementation, it is clear that we have to prevent the API request if the value has not changed. And both proposals have mentioned this.

@cretadn22 additionally proposed to trim the value but that is just a minor change and could have been identified during PR review. Calling Keyboard.dismiss() is not required here as there is no value-add and is not fixing any bug. Implementing the same logic to Value page is also not required as setting the same value is not an error in BE and does not result in a bug. Because of this, I don't find a good basis to give preference to this proposal.

@GandalfGwaihir proposal LGTM as that was the first one to get to the correct RCA and solution
🎀👀🎀 C+ reviewed

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

melvin-bot bot commented May 30, 2024

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

Offer link
Upwork job

Copy link

melvin-bot bot commented May 30, 2024

📣 @GandalfGwaihir 🎉 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 📖

@allgandalf
Copy link
Contributor

PR would be ready by EOD 👍

@allgandalf
Copy link
Contributor

Android build is failing on main 😞 we have active slack convo too, if this doesn't get resolved by today i will still put up the PR on all other platforms except android native

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jun 2, 2024
@allgandalf
Copy link
Contributor

Android finally builds 🥳 , PR ready for review c.c. @rojiphil

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 6, 2024
@melvin-bot melvin-bot bot changed the title [$250] mWeb - Tax - Saving tax name without altering displays error message [HOLD for payment 2024-06-13] [$250] mWeb - Tax - Saving tax name without altering displays error message Jun 6, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 6, 2024
Copy link

melvin-bot bot commented Jun 6, 2024

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

Copy link

melvin-bot bot commented Jun 6, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.79-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 2024-06-13. 🎊

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

Copy link

melvin-bot bot commented Jun 6, 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:

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

@laurenreidexpensify
Copy link
Contributor

@allgandalf just to confirm - are you Rohan in Upwork ?

@allgandalf
Copy link
Contributor

Yes @laurenreidexpensify , that is right 👍

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 12, 2024
@laurenreidexpensify
Copy link
Contributor

Payment Summary:

@rojiphil pls confirm checklist and regression steps above thanks

@rojiphil
Copy link
Contributor

  • [@rojiphil] The PR that introduced the bug has been identified. Link to the PR: Offending PR
  • [@rojiphil] 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: Added comment
  • [@rojiphil] 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: Not Required. Existing checklist is good enough to capture such issues.
  • [@rojiphil] Determine if we should create a regression test for this bug. : Not needed as this is an edge case and does not come in the critical path.
  • [@rojiphil] 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. NA

@rojiphil
Copy link
Contributor

@laurenreidexpensify BZ Checklist done and accepted offer. Thanks.

@laurenreidexpensify
Copy link
Contributor

Payment Summary:

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
Archived in project
Development

No branches or pull requests

6 participants