Skip to content

Tax amount field remains unchanged after changing amount when submitting expense from self DM #92823

Closed

Description

@applause-bot

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

Action Performed:

Precondition:

  • Run Onyx.merge('betas', ['newManualExpenseFlow']); in console.
  • Enable Taxes in workspace settings.
  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create a manual expense with 5% rate.
  4. Click Submit it to someone.
  5. Select workspace chat.
  6. On confirm page, change the amount to any value.

Expected Result:

Tax amount field will update accordingly when amount is changed.

Actual Result:

Tax amount field remains unchanged after changing amount when submitting from self DM

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7172892_1780684105320.12.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Nathan Lemma
Bug ID: 7172892

Issue OwnerCurrent Issue Owner: @dukenv0307

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 5, 2026
  2. applause-bot commented on Jun 5, 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/f1a7ec343f6be7a7a00d2f462eab55796f989935f56cf32688024a2680eeac01

  3. melvin-bot commented on Jun 5, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jun 5, 2026

    @melvin-bot

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

  5. melvin-bot commented on Jun 5, 2026

    @melvin-bot

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

  6. github-actions commented on Jun 5, 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.
  7. MelvinBot commented on Jun 5, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    Submitting an expense from a self DM ("Submit it to someone") runs the move-from-track-expense flow — the SUBMIT action makes isMovingTransactionFromTrackExpense return true. That flag short-circuits tax-amount recalculation, so when you change the amount on the confirmation page the stored transaction.taxAmount is never updated, and the inline tax field keeps showing the stale value.

    Two places block the recalc when moving:

    1. TaxController.tsx:52-56 — the effect that persists the recalculated tax amount via setMoneyRequestTaxAmount returns early when isMovingTransactionFromTrackExpense is true.
    2. useTaxAmount.ts:68 — even if the effect ran, this returns the original transaction.taxAmount (instead of calculateTaxAmount(...)) whenever moving and a tax amount already exists.

    The inline field's value is read straight from the transaction (getTaxAmount(transactionForHelpers) at TaxFields.tsx:55), so with the stored value frozen the displayed tax never changes — matching the report exactly.

    Why this only repros from a self DM, and why the input remount doesn't save it
    • The non-moving create flow (e.g. starting directly from a workspace chat) does not hit the guard, so TaxController re-runs setMoneyRequestTaxAmount on every amount change and the field updates correctly. Only the move flows (SUBMIT/SHARE/CATEGORIZE) are affected.
    • The inline NumberWithSymbolForm is keyed by taxAmountInputKey which includes the expense amount, so it does remount when the amount changes — but it remounts onto the same stale transaction.taxAmount, so the user sees no change.
    • This is design intent vs. bug tension: the guard was added to preserve the moved expense's original tax amount on mount. The fix must keep that initial preservation while still recalculating once the user actively edits the amount.

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

    Allow the tax amount to recalculate on the confirmation page when the user changes the expense amount, even in the move-from-track-expense flow, while still preserving the original tax amount on initial load.

    Concretely:

    • In useTaxAmount.ts:68, stop returning the frozen transaction.taxAmount once the amount has changed from the value that produced it — recompute via calculateTaxAmount(...) instead.
    • In TaxController.tsx, let the tax-amount persistence effect run for the move flow when the amount changes (rather than bailing out unconditionally on isMovingTransactionFromTrackExpense), so the recomputed value is written to the draft.

    What alternative solutions did you explore? (Optional)

    Recompute and persist taxAmount directly inside the amount-change handler for the move flow (so the controller guards stay untouched), gating on "amount actually changed" to avoid clobbering a user-entered tax amount on first load.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/92823) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  8. godzillaxbox19982014-lgtm commented on Jun 6, 2026

    @godzillaxbox19982014-lgtm

    Proposal

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

    Tax amount field remains unchanged after changing amount when submitting expense from self DM

    What is the root cause of that problem?

    I traced this to the path that handles workspace name, expense report, DM:

    • src/libs/actions/IOU/SplitTransactionUpdate.ts:757 (newTransactionReportID): const newTransactionReportID = isSelfDMPerDiemSplit ? CONST.REPORT.UNREPORTED_REPORT_ID : (workspaceExpenseReportID ?? splitExpense?.reportID);
    • src/pages/iou/SplitExpensePage.tsx:269 (addSplitExpenseField): addSplitExpenseField(transaction, draftTransaction, transactionReport, effectivePolicy, isDraftSelfDMContext);
    • src/pages/iou/SplitExpenseEditPage.tsx:267 (if): if (isSelfDMSplit && !effectivePolicy && !hasAnyPaidWorkspace && reportID) {
    • The local evidence matches this recurring failure shape: optimistic transaction/report data is written to one Onyx key but the visible list reads another derived key. Here, src/libs/actions/IOU/SplitTransactionUpdate.ts:757 and src/pages/iou/SplitExpensePage.tsx:269 do not agree on the same workspace name, expense report, DM value, so the user-visible path can show a missing or stale state even though nearby data already has the needed context.

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

    • Update src/libs/actions/IOU/SplitTransactionUpdate.ts:757 to derive workspace name, expense report, DM from the report/transaction source that owns this flow before the value is consumed.
    • Carry the same normalized value through src/pages/iou/SplitExpensePage.tsx:269; that follows the safer family move to align optimistic/success/failure data with the selector consumed by the screen, so the write/optimistic/read paths agree instead of only changing the visible component.
    • Keep the change inside the Reports, Expenses, IOU, Transactions surface and avoid changing payment actions, personal/deleted policies.

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

    1. Add or update a regression in tests/unit/ReportUtils*.ts for the exact issue flow: Tax amount field remains unchanged after changing amount when submitting expense from self DM.
    2. Cover the counter-case near src/libs/actions/IOU/SplitTransactionUpdate.ts:757 so valid existing workspace name, expense report, DM behavior still works.
    3. Manually repeat the issue steps after the patch and confirm the visible state/action is no longer stale.

    What alternative solutions did you explore? (Optional)

    • I would not add a broad new condition outside these referenced paths; the safer fix is to keep workspace name, expense report, DM consistent at the first read/write boundary shown above.
  9. melvin-bot commented on Jun 9, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  10. m-natarajan commented on Jun 9, 2026

    @m-natarajan

    issue not reproducible using Staging v9.4.0-5.

    Screen.Recording.2026-06-09.at.7.43.09.AM.mov
  11. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Jun 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.DailyKSv2EngineeringReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions