Skip to content

Rules - Disabled tax rate is not shown in the list when it is selected #100504

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.73-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 BrowserStack: #99420
Email or phone of affected tester (no customers): applausetester+ssndjois2jd1@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Workspace Settings

Action Performed:

Precondition:

  • Log in with Expensifail account.
  • Enable Taxes and Rules.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Rules.
  3. Click Add rule > Apply expense defaults.
  4. Click Category.
  5. Select a category and tax rate.
  6. Click Save rule.
  7. Go to workspace settings > Taxes.
  8. Disable the tax rate used in Step 5.
  9. Go to workspace settings > Rules > Expense defaults.
  10. Open the rule created in Step 6.
  11. Click Tax field.

Expected Result:

The disabled tax rate will be shown in the list because it is selected.

Actual Result:

The disabled tax rate is not shown in the list when it is selected.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7253337_1788782320939.6.1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7253337

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 7, 2026
  2. applause-bot commented on Sep 7, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/d8cb8b3f8d2b619cd926e03cdea6457a27909b4bbd22b76b158117491204584e

  3. melvin-bot commented on Sep 7, 2026

    @melvin-bot

    @JS00001 recently merged #99420, but they are OOO right now, so I'll auto-assign someone else.

  4. github-actions commented on Sep 7, 2026

    @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.
  5. melvin-bot commented on Sep 7, 2026

    @melvin-bot

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

  6. melvin-bot commented on Sep 7, 2026

    @melvin-bot

    @JS00001 @situchan you have been assigned to this deploy blocker because you reviewed the offending PR: #99420

  7. melvin-bot commented on Sep 7, 2026

    @melvin-bot

    @Krishna2323 you have been assigned to this deploy blocker because you authored the offending PR: #99420

  8. melvin-bot commented on Sep 7, 2026

    @melvin-bot

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

  9. MelvinBot commented on Sep 7, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #99420 - "Add category tax defaults to Expense defaults" by @Krishna2323 (Medium confidence — it created the repro's entry point, but it did not author the offending line; see Evidence)
    Related Issues: none found

    Recommendation: ROLL FORWARD

    The offending !tax.isDisabled filter pre-dates #99420 (it shipped with the original merchant-rules tax picker), so reverting #99420 would only hide the reported entry point while leaving the identical defect in the merchant-rule tax picker. The fix is a 2-line change in one file, versus reverting a 43-file feature PR that has follow-up commits stacked on it.

    Assigned: @Krishna2323 (PR author), @situchan and @JS00001 (approving reviewers) from #99420 — all already auto-assigned, no change needed
    Labels: No changes. DeployBlockerCash is correctly applied and kept (App-side fix). DeployBlocker was not present, so nothing to remove.

    📋 Detailed Analysis

    Evidence

    The repro path (Rules > Add rule > Apply expense defaults > Category > Tax) is the flow #99420 introduced: it added the RULES_CATEGORY_TAX_EDIT route, the categoryName route param, and EditCategoryTaxRulePage, and reused the existing AddTaxPage as the picker for category tax defaults. That is consistent with "Reproducible in production?: N/A - new feature".

    Important nuance for the revert decision: the !tax.isDisabled filter that actually causes this bug was not added by #99420. The PR diff shows it only threading taxKey into the existing predicate to add the separate shouldHideTax (workspace-default) exclusion:

    -        .filter(([, tax]) => !tax.isDisabled && tax.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE)
    +        .filter(([taxKey, tax]) => !tax.isDisabled && tax.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && !shouldHideTax(taxKey))

    So #99420 exposed a latent defect in a new flow rather than writing it. The same bug is reachable through the merchant-rule tax picker, which a revert would not fix.

    Verification

    Affected file — src/pages/workspace/rules/MerchantRules/AddTaxPage.tsx#L38-L45:

    • L39 filters disabled rates out of taxItems.
    • L45 then resolves the current selection from that already-filtered list: taxItems.find(({value}) => value === form.tax).

    Confirmed #99420 modifies this exact file (gh pr view 99420 --json files lists src/pages/workspace/rules/MerchantRules/AddTaxPage.tsx), and #99420 is on the current deploy checklist #100479.

    Root Cause

    Once the rate is disabled in step 8, it is dropped from taxItems at L39, so the .find() at L45 returns undefined and selectedTaxItem becomes undefined.

    That matters because SearchSingleSelectionPicker renders initiallySelectedItem in its own section, independent of items. It is already capable of displaying a selected-but-filtered-out option; it just never receives one here. The rule's saved tax therefore vanishes from the picker entirely.

    Established precedent — this is the odd one out of three sibling pickers in the same feature:

    Suggested minimal fix

    Resolve the selection from the unfiltered rates, mirroring AddCategoryPage. Replace L45:

    // A rate can be disabled after the rule was saved. SearchSingleSelectionPicker renders initiallySelectedItem in
    // its own section, so resolve the selection from the unfiltered rates to keep the rule's current value visible.
    const selectedTax = form?.tax ? taxes[form.tax] : undefined;
    const selectedTaxItem = form?.tax && selectedTax && !shouldHideTax(form.tax) ? {name: `${selectedTax.name} (${selectedTax.value})`, value: form.tax} : undefined;

    No new imports, and taxItems (L38-43) stays untouched so disabled rates remain unselectable for new rules. shouldHideTax is still honoured so the workspace-default rate is not surfaced in a category rule. remainingItemsSection already de-dupes on item.value !== initialSelectedItem?.value, so the row will not render twice.


    💡 Suggested AI code review rule

    This bug looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for Expensify/App:

    • Rule: UI-4 Keep the selected option visible even when it is disabled
    • Condition: Flag when the currently-selected picker option is resolved by .find() over a list that was itself built with a .filter() on isDisabled / .enabled / pendingAction. Resolve the selection from the unfiltered source instead, so a value disabled after it was saved still renders as the current selection.
    • Why: The selected item silently disappears from the picker, so the user cannot see what their saved record is set to and the field reads as empty. Motivating incident: Rules - Disabled tax rate is not shown in the list when it is selected #100504.
    • Search pattern: a selected*Item/selected* assignment of the form <list>.find( where <list> is produced by .filter( whose predicate mentions isDisabled, .enabled, or pendingAction — e.g. rg -U 'const \w+ = Object\.(values|entries)\([\s\S]{0,200}?\.filter\([^)]*(isDisabled|\.enabled|pendingAction)[\s\S]{0,400}?\.find\(' over src/
    • Offending code (❌): AddTaxPage.tsx#L38-L45
    • Fix (✅): no fix commit exists yet; the ✅ shape is the existing precedent at AddTagPage.tsx#L39-L44, AddCategoryPage.tsx#L27, and TaxOptionsListUtils.ts#L83-L104

    Three independent call sites already implement this correctly in three different ways, which is the "codebase is riddled with this pattern" signal. The full rule file, with the ❌/✅ code inline in Expensify/App's coding-standards format, would go in Expensify/App itself. If it's worth adding, a maintainer can open it there as a draft PR.

  10. Julesssss commented on Sep 7, 2026

    @Julesssss
    Contributor

    N/A - new feature, doesn't exist in prod

    Not a blocker, demoting. Authors are assigned.

  11. removed their assignment
    on Sep 7, 2026
  12. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Sep 7, 2026
  13. situchan commented on Sep 7, 2026

    @situchan
    Contributor

    yup not blocker. The feature is behind beta.

  14. added
    ReviewingHas a PR in review
    and removed on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions