Skip to content

[Due for payment 2025-03-13] [$250] Track tax - RHP opens tax settings instead of distance rate after selecting the same tax rate #57233

Closed

Description

@IuliiaHerets

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.1.3-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): applausetester+sj9032@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.0 / Chrome
App Component: Workspace Settings

Action Performed:

Precondition:

  • Distance rates and tax features are enabled.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Distance rates.
  3. Click Settings.
  4. Enable Track tax.
  5. Close the RHP.
  6. Open any distance rate.
  7. Click Tax rate.
  8. Select a tax rate.
  9. Click Tax rate.
  10. Click on the already selected tax rate.

Expected Result:

RHP will return to distance rate page.

Actual Result:

RHP opens tax settings page.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6749810_1740123564296.20250221_152838.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021892975947202280745
  • Upwork Job ID: 1892975947202280745
  • Last Price Increase: 2025-02-21
  • Automatic offers:
    • daledah | Contributor | 106307625
Issue OwnerCurrent Issue Owner: @bfitzexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Feb 21, 2025
  2. melvin-bot commented on Feb 21, 2025

    @melvin-bot

    Triggered auto assignment to @bfitzexpensify (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. daledah commented on Feb 21, 2025

    @daledah
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-02-21 08:38:35 UTC.

    Proposal

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

    RHP opens tax settings page.

    What is the root cause of that problem?

    When we click the item again we call onDismiss function

    const handleSelectRow = useCallback(
    (newSelectedOption: TaxOptionsListUtils.TaxRatesOption) => {
    if (selectedOptionKey === newSelectedOption.keyForList) {
    onDismiss();
    return;
    }

    We should navigate to WORKSPACE_TAXES_SETTINGS route

    const dismiss = () => {
    Navigation.goBack(ROUTES.WORKSPACE_TAXES_SETTINGS.getRoute(policyID));
    };

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

    We are navigating to WORKSPACE_DISTANCE_RATE_DETAILS route when dismissing

        const dismiss = () => {
            Navigation.goBack(ROUTES.WORKSPACE_DISTANCE_RATE_DETAILS.getRoute(policyID, rateID));
        };
    

    const dismiss = () => {
    Navigation.goBack(ROUTES.WORKSPACE_TAXES_SETTINGS.getRoute(policyID));
    };

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. twilight2294 commented on Feb 21, 2025

    @twilight2294
    Contributor

    Proposal

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

    RHP opens tax settings instead of distance rate after selecting the same tax rate

    What is the root cause of that problem?

    
The implementation of PolicyDistanceRateTaxRateEditPage is totally wrong here. 

The current bug happens because when we select the same option we call dismiss function:



    const dismiss = () => {
    Navigation.goBack(ROUTES.WORKSPACE_TAXES_SETTINGS.getRoute(policyID));
    };

    This leads us to the WORKSPACE_TAXES_SETTINGS page.


    This is the RCA, now there is not need to call the dismiss function here, we already handle the logic to navigate back in the onTaxRateChange function:


    const onTaxRateChange = (newTaxRate: TaxOptionsListUtils.TaxRatesOption) => {
    if (taxRateExternalID === newTaxRate.code) {
    Navigation.goBack();
    return;
    }

    
So the use of dismiss was introduced in 


    But the implementation was not rightly done leading to this bug, that PR added the filter logic correctly but pretty badly affected the navigation logic.

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

    1. Remove the use of OnDismiss from the parent TaxPicker, ie. remove the handleSelectRow function:

    const handleSelectRow = useCallback(
    (newSelectedOption: TaxOptionsListUtils.TaxRatesOption) => {
    if (selectedOptionKey === newSelectedOption.keyForList) {
    onDismiss();
    return;
    }
    onSubmit(newSelectedOption);
    },
    [onSubmit, onDismiss, selectedOptionKey],
    );

    1. Replace the usage of handleSelectRow with onSubmit as that is what is done when we select the row:

      onSelectRow={handleSelectRow}

    2. Remove onDismiss function in PolicyDistanceRateTaxRateEditPage:

      const dismiss = () => {
      Navigation.goBack(ROUTES.WORKSPACE_TAXES_SETTINGS.getRoute(policyID));
      };

    3. The case when we select the same key is already taken care of here:

    const onTaxRateChange = (newTaxRate: TaxOptionsListUtils.TaxRatesOption) => {
    if (taxRateExternalID === newTaxRate.code) {
    Navigation.goBack();
    return;

    So we don't need to introduce any new thing. We also need to update a few places where TaxPicker is used, but this is the clean approach to solve this bug as we do not need OnDismiss and handleSelectRow can directly have the function onSubmit which simplifies logic handling
    


    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A this is a navigation bug

    What alternative solutions did you explore? (Optional)

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Feb 21, 2025
  6. changed the title [-]Track tax - RHP opens tax settings instead of distance rate after selecting the same tax rate[/-] [+][$250] Track tax - RHP opens tax settings instead of distance rate after selecting the same tax rate[/+] on Feb 21, 2025
  7. melvin-bot commented on Feb 21, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 21, 2025
  9. moved this to Bugs and Follow Up Issues in #expensify-bugson Feb 21, 2025
  10. melvin-bot commented on Feb 21, 2025

    @melvin-bot

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

  11. melvin-bot commented on Feb 25, 2025

    @melvin-bot

    @ishpaul777 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  12. 23 remaining items

  13. melvin-bot commented on Mar 6, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.9-8 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 2025-03-13. 🎊

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

  14. melvin-bot commented on Mar 6, 2025

    @melvin-bot

    @ishpaul777 @bfitzexpensify @ishpaul777 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]

  15. bfitzexpensify commented on Mar 13, 2025

    @bfitzexpensify
    Contributor

    Payment complete to @daledah

    @ishpaul777, please complete the BZ checklist

  16. ishpaul777 commented on Mar 13, 2025

    @ishpaul777
    Contributor

    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 (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 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/44046/files#r1993944642

    • [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: no need simple navigation issue does not block any functionality

    • [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. - no need simple navigation issue does not block any functionality

  17. melvin-bot commented on Mar 17, 2025

    @melvin-bot

    @bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  18. bfitzexpensify commented on Mar 18, 2025

    @bfitzexpensify
    Contributor

    Payment summary:

    @ishpaul777 due $250 via NewDot manual request for C+ work

  19. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Mar 18, 2025
  20. garrettmknight commented on Mar 24, 2025

    @garrettmknight
    Contributor

    $250 approved for @ishpaul777

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