Skip to content

Expense - Tax amount field does not update after bulk editing tax rate offline #84666

Closed

Description

@mitarachim

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.3.34-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: #82948
Email or phone of affected tester (no customers): jsiodjsojndoiosnj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Enable Taxes.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create two expenses with 0% tax rate.
  4. Open the report.
  5. Go offline.
  6. Bulk select the expenses.
  7. Click dropdown button > Edit multiple.
  8. Click Tax rate.
  9. Select 5% rate.
  10. Click Save.
  11. Open any expense.

Expected Result:

Tax amount field will update because tax rate is changed.

Actual Result:

Tax amount field does not update after bulk editing tax rate offline.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7098349_1773099668773.10.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    DeployBlocker
    on Mar 10, 2026
  2. melvin-bot commented on Mar 10, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #82948

  3. melvin-bot commented on Mar 10, 2026

    @melvin-bot

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

  4. melvin-bot commented on Mar 10, 2026

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

  5. github-actions commented on Mar 10, 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.
  6. OSBotify commented on Mar 10, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #82948 - "Reapply "Feat: bulk edit multiple"" by @pasyukevich (High confidence)
    Related Issues: None

    Recommendation: REVERT

    The bulk edit feature is missing critical tax amount calculation logic when editing tax rates offline. This causes the tax amount field to not update when users bulk edit the tax rate, which is a core functionality issue that will confuse users and lead to incorrect expense data.

    Labels: No label changes made (keeping both DeployBlockerCash and DeployBlocker since this is a frontend bug that needs a fix in the App repo)

    📋 Detailed Analysis

    Evidence

    The issue reproduces when bulk editing tax rate offline:

    1. User creates expenses with 0% tax rate
    2. Goes offline
    3. Bulk selects expenses and changes tax rate to 5%
    4. Opens an expense and sees tax amount field did not update

    The causing PR introduced the bulk edit feature which includes SearchEditMultipleTaxPage.tsx and the updateMultipleMoneyRequests function.

    Verification

    I verified that PR #82948 modified the following key files that are directly involved in this bug:

    • src/pages/Search/SearchEditMultiple/SearchEditMultipleTaxPage.tsx (new file)
    • src/libs/actions/IOU/index.ts (added updateMultipleMoneyRequests function)
    • src/libs/TransactionUtils/index.ts (modified getUpdatedTransaction function)

    Root Cause

    The bug occurs because the bulk edit tax flow only updates taxCode but does not calculate the corresponding taxAmount:

    In SearchEditMultipleTaxPage.tsx (lines 46-48):

    updateBulkEditDraftTransaction({
        taxCode: nextTaxCode,
    });

    This only stores the tax code, without calculating what the tax amount should be.

    In TransactionUtils/index.ts getUpdatedTransaction function (lines 807-809):

    if (Object.hasOwn(transactionChanges, 'taxCode') && typeof transactionChanges.taxCode === 'string') {
        updatedTransaction.taxCode = transactionChanges.taxCode;
    }

    This only updates the tax code on the transaction, but does NOT recalculate the taxAmount based on the new tax rate and the expense amount.

    Compare this to how category changes handle taxes (lines 825-829):

    if (Object.hasOwn(transactionChanges, 'category') && typeof transactionChanges.category === 'string') {
        updatedTransaction.category = transactionChanges.category;
        const {categoryTaxCode, categoryTaxAmount} = getCategoryTaxCodeAndAmount(transactionChanges.category, transaction, policy);
        if (categoryTaxCode && categoryTaxAmount !== undefined) {
            updatedTransaction.taxCode = categoryTaxCode;
            updatedTransaction.taxAmount = categoryTaxAmount;
        }
    }

    When category is changed, the code properly recalculates both taxCode AND taxAmount. The same logic is missing for when taxCode is changed directly.

    Also compare to single expense tax rate editing:
    The updateMoneyRequestTaxRate function (lines 5698-5733 in IOU/index.ts) receives taxCode, taxAmount, AND taxValue as pre-calculated parameters, meaning the caller computes the tax amount before updating. The bulk edit flow fails to do this calculation.

    Expected Behavior

    When a tax rate is bulk edited:

    1. The taxCode should be updated
    2. The taxAmount should be calculated as: (transaction.amount * taxRate.value) / 100
    3. Both fields should be updated optimistically so users see the change immediately
  7. removed
    DeployBlocker
    on Mar 10, 2026
  8. OSBotify commented on Mar 10, 2026

    @OSBotify
    Contributor

    Label Update: Removed DeployBlocker label and keeping DeployBlockerCash since this is a frontend bug in the App repository that blocks the mobile app deploy. The backend API can deploy safely.

  9. MelvinBot commented on Mar 10, 2026

    @MelvinBot
    Contributor

    Proposal

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

    When bulk editing the tax rate of multiple expenses while offline, the tax amount field does not update to reflect the new tax rate. For example, changing from 0% to 5% updates the tax rate label but the tax amount stays at $0.00.

    What is the root cause of that problem?

    The bulk edit tax rate flow only passes taxCode in the transaction changes — it never computes or includes taxAmount or taxValue.

    In the single-transaction edit path (src/pages/iou/request/step/IOURequestStepTaxRatePage.tsx), the UI explicitly calculates the new taxAmount using calculateTaxAmount() from TransactionUtils, then passes all three fields (taxCode, taxAmount, taxValue) to updateMoneyRequestTaxRate().

    In the bulk edit path, SearchEditMultipleTaxPage.tsx only stores taxCode in the draft transaction (line ~46). Then SearchEditMultiplePage.tsx save() only adds taxCode to the changes object (line ~121). Finally, updateMultipleMoneyRequests() in src/libs/actions/IOU/index.ts (line ~14050) forwards only taxCode to getUpdatedTransaction().

    Since getUpdatedTransaction() in TransactionUtils/index.ts (line ~803) only updates fields that are explicitly present in transactionChanges, the taxAmount remains unchanged because it was never included.

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

    In updateMultipleMoneyRequests() in src/libs/actions/IOU/index.ts, when processing a taxCode change for each transaction, we should:

    1. Look up the tax rate percentage for the new taxCode from the policy's tax rates
    2. Call calculateTaxAmount() with that percentage and the transaction's amount to compute the new taxAmount
    3. Get the taxValue (the percentage string) for the new taxCode
    4. Include both taxAmount and taxValue in transactionChanges alongside taxCode

    This mirrors what the single-transaction edit already does in IOURequestStepTaxRatePage.tsx, ensuring the optimistic update correctly reflects the recalculated tax amount for each transaction.

    What alternative solutions did you explore? (Optional)

    An alternative would be to make getUpdatedTransaction() automatically recalculate taxAmount whenever taxCode changes. However, this would require getUpdatedTransaction() to have access to the policy's tax rates (which it currently doesn't take as a parameter), and it would change behavior for all callers. The more targeted fix in updateMultipleMoneyRequests() is safer and consistent with how the single-edit path handles this.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  10. added
    Reviewing
    on Mar 10, 2026
  11. IuliiaHerets commented on Mar 10, 2026

    @IuliiaHerets

    Chrome / 9.3.34-1
    No Edit multiple option

    Screen.Recording.2026-03-10.at.20.03.00.mp4
  12. removed
    DeployBlockerCash
    on Mar 10, 2026
  13. marcaaron commented on Apr 3, 2026

    @marcaaron
    Contributor

    Fixed in #84756

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugEngineeringHourlyReviewing

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions