Skip to content

[HOLD for payment 2024-06-28] [$250] Taxes - Selected tax rate for Workspace currency default can be unselected which causes error #42854

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.77-8
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4584734
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings
  3. Go to Taxes (enable it if not enabled)
  4. Click Settings
  5. Click Workspace currency default
  6. Click on the selected tax rate

Expected Result:

App will not unselect the tax rate since Workspace currency default must have a tax rate

Actual Result:

The selected tax rate is unselected which results in a blank tax rate created with error "Invalid tax for default currency". The error message cannot be dismissed too
After unselecting the tax rate, the tax rate is selected again

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

Bug6496493_1717088280521.20240531_005324.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f0cd7866af3328d2
  • Upwork Job ID: 1796250642764570624
  • Last Price Increase: 2024-06-06
  • Automatic offers:
    • DylanDylann | Contributor | 102691550
    • dominictb | Contributor | 102691783
Issue OwnerCurrent Issue Owner: @isabelastisser

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 30, 2024
  2. melvin-bot commented on May 30, 2024

    @melvin-bot

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

  3. lanitochka17 commented on May 30, 2024

    @lanitochka17
    Author

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

  4. lanitochka17 commented on May 30, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #wave-collect - Release 1

  5. Krishna2323 commented on May 30, 2024

    @Krishna2323
    Contributor

    Proposal

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

    Taxes - Selected tax rate for Workspace currency default can be unselected which causes error

    What is the root cause of that problem?

    Before updating the tax we don't check if the selected tag is the same as the new selected tag.

    const submit = (taxes: OptionsListUtils.TaxRatesOption) => {
    setWorkspaceCurrencyDefault(policyID, taxes.code ?? '');
    Navigation.goBack(ROUTES.WORKSPACE_TAXES_SETTINGS.getRoute(policyID));
    };

    const submit = (taxes: OptionsListUtils.TaxRatesOption) => {
    setForeignCurrencyDefault(policyID, taxes.code ?? '');
    Navigation.goBack(ROUTES.WORKSPACE_TAXES_SETTINGS.getRoute(policyID));
    };

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

    Only update the tax when the new selected tax is different from the previous selected tag.

            if (selectedTaxRate !== taxes.text) {
                setWorkspaceCurrencyDefault(policyID, taxes.code ?? '');
            }

    Add the same in WorkspaceTaxesSettingsForeignCurrency if required.

    What alternative solutions did you explore? (Optional)

  6. Nodebrute commented on May 30, 2024

    @Nodebrute
    Contributor

    Proposal

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

    Selected tax rate for Workspace currency default can be unselected which causes error

    What is the root cause of that problem?

    We are not returning early if the tax rate is same just like we do here

    App/src/libs/actions/Report.ts

    Lines 1929 to 1934 in 6af6811

    function updateDescription(reportID: string, previousValue: string, newValue: string) {
    // No change needed, navigate back
    if (previousValue === newValue) {
    Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(reportID));
    return;
    }

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

    We should early return from here and here just like we do here. We can pass previousTaxCode and then compare it with new one and then we can early return from the functions.

    Here we are navigating back but in the case of taxes we can just early return. No need to navigate back, we are navigating here

    App/src/libs/actions/Report.ts

    Lines 1929 to 1934 in 6af6811

    function updateDescription(reportID: string, previousValue: string, newValue: string) {
    // No change needed, navigate back
    if (previousValue === newValue) {
    Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(reportID));
    return;
    }

    What alternative solutions did you explore? (Optional)

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 30, 2024
  8. melvin-bot commented on May 30, 2024

    @melvin-bot
  9. changed the title [-]Taxes - Selected tax rate for Workspace currency default can be unselected which causes error[/-] [+][$250] Taxes - Selected tax rate for Workspace currency default can be unselected which causes error[/+] on May 30, 2024
  10. melvin-bot commented on May 30, 2024

    @melvin-bot

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

  11. 31 remaining items

  12. changed the title [-][$250] Taxes - Selected tax rate for Workspace currency default can be unselected which causes error[/-] [+][HOLD for payment 2024-06-28] [$250] Taxes - Selected tax rate for Workspace currency default can be unselected which causes error[/+] on Jun 21, 2024
  13. melvin-bot commented on Jun 21, 2024

    @melvin-bot

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

  14. melvin-bot commented on Jun 21, 2024

    @melvin-bot

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

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

  15. melvin-bot commented on Jun 21, 2024

    @melvin-bot

    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:

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

    @DylanDylann
    Contributor

    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:

    [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: NA
    [@DylanDylann] 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: NA
    [@DylanDylann] 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: NA
    [@DylanDylann] Determine if we should create a regression test for this bug. Yes
    [@DylanDylann] 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.

    Regression Test Proposal

    1. Go to the app
    2. Go to workspace settings
    3. Go to Taxes (enable it if not enabled)
    4. Click Settings
    5. Click Workspace currency default
    6. Click on the selected tax rate
    7. App will not unselect the tax rate since Workspace currency default must have a tax rate. No error happens

    Do we agree 👍 or 👎

  17. isabelastisser commented on Jun 28, 2024

    @isabelastisser
    Contributor

    @blimpich, can you look at the test regression proposal above? Thanks!

  18. isabelastisser commented on Jun 29, 2024

    @isabelastisser
    Contributor

    The payments were processed un Upwork.

  19. isabelastisser commented on Jun 29, 2024

    @isabelastisser
    Contributor

    All set!

  20. moved this from Release 1: Spring 2024 (May) to Done in [#whatsnext] #wave-collecton Jun 29, 2024
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.DailyKSv2ExternalAdded 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