Skip to content

[Due for payment 2025-02-10] [$250] Distance rates - Dropdown does not show "Enable" after disabling rate while selecting all rates #55052

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.0.83-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
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+010108kh@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.0 / Chrome
App Component: Workspace Settings

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Distance rates.
  3. Add one more distance rate if there is only one rate.
  4. Select all rates via checkbox.
  5. Click on the toggle on one of the rates to disable it.
  6. Click on the dropdown button on the top right.

Expected Result:

The dropdown menu will show "Enable" option because now there is a disabled rate (it works this way with categories).

Actual Result:

The dropdown menu does not show "Enable" option after disabling a rate while selecting all rates.
It only appears after reselecting the rates.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6710576_1736485086531.20250110_123206.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021877738099993152916
  • Upwork Job ID: 1877738099993152916
  • Last Price Increase: 2025-01-10
Issue OwnerCurrent Issue Owner: @abekkala

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 10, 2025
  2. melvin-bot commented on Jan 10, 2025

    @melvin-bot

    Triggered auto assignment to @abekkala (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. melvin-bot commented on Jan 10, 2025

    @melvin-bot

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

  4. melvin-bot commented on Jan 10, 2025

    @melvin-bot

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

  5. github-actions commented on Jan 10, 2025

    @github-actions
    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.
  6. nkdengineer commented on Jan 10, 2025

    @nkdengineer
    Contributor

    Edited by proposal-police: This proposal was edited at 2025-01-10 08:28:21 UTC.

    Proposal

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

    The dropdown menu does not show "Enable" option after disabling a rate while selecting all rates.
    It only appears after reselecting the rates.

    What is the root cause of that problem?

    We are not updating selectedDistanceRates when update distance rate status

    const updateDistanceRateEnabled = useCallback(
    (value: boolean, rateID: string) => {
    if (!customUnit) {
    return;
    }
    const rate = customUnit?.rates?.[rateID];
    // Rates can be disabled or deleted as long as in the remaining rates there is always at least one enabled rate and there are no pending delete action
    const canDisableOrDeleteRate = Object.values(customUnit?.rates ?? {}).some(
    (distanceRate: Rate) => distanceRate?.enabled && rateID !== distanceRate?.customUnitRateID && distanceRate?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
    );
    if (!rate?.enabled || canDisableOrDeleteRate) {
    DistanceRate.setPolicyDistanceRatesEnabled(policyID, customUnit, [{...rate, enabled: value}]);
    } else {
    setIsWarningModalVisible(true);
    }
    },
    [customUnit, policyID],

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

    We can rely on rateID and value in the function updateDistanceRateEnabled to update selectedDistanceRates

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

    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.

  7. Gonals commented on Jan 10, 2025

    @Gonals
    Contributor

    #54451 Should have fixed this. Closing

  8. 9 remaining items

  9. Gonals commented on Jan 10, 2025

    @Gonals
    Contributor

    @thienlnam, @mountiny, I don't think we need to block deploy on this. It is a new feature (you couldn't really do this flow before the switch) and not very intrusive. That said, it is Friday, so we have until Monday to fix this.

    @abzokhattab, @abekkala, this was caused by #54451

  10. thienlnam commented on Jan 10, 2025

    @thienlnam
    Contributor

    Looks like I'll be able to deploy today, going to revert it since it is linked to another blocker as well

  11. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Feb 3, 2025
  12. changed the title [-][$250] Distance rates - Dropdown does not show "Enable" after disabling rate while selecting all rates[/-] [+][Due for payment 2025-02-10] [$250] Distance rates - Dropdown does not show "Enable" after disabling rate while selecting all rates[/+] on Feb 3, 2025
  13. melvin-bot commented on Feb 3, 2025

    @melvin-bot

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

  14. melvin-bot commented on Feb 3, 2025

    @melvin-bot

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

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

    • @paultsimura requires payment (Needs manual offer from BZ)
  15. melvin-bot commented on Feb 3, 2025

    @melvin-bot

    @paultsimura @abekkala @paultsimura 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]

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.EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions