Skip to content

Split - Split amount field changes to NaN after clearing other split amount field #81241

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.11-23
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #79273
Email or phone of affected tester (no customers): sodjnsoidjsnosijoi@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.1 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense with negative amount.
  4. Open the expense report.
  5. Click More > Split.
  6. Click any split amount field.
  7. Clear the field but leave the negative sign.

Expected Result:

The other split amount field will update to the total amount.

Actual Result:

The other split amount field changes to NaN.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7064887_1770089817280.5.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Feb 3, 2026
  2. melvin-bot commented on Feb 3, 2026

    @melvin-bot

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

  3. melvin-bot commented on Feb 3, 2026

    @melvin-bot

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

  4. melvin-bot commented on Feb 3, 2026

    @melvin-bot

    Triggered auto assignment to @joekaufmanexpensify (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 Feb 3, 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 Feb 3, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #79273 - "feat: update amounts/percentages split logic to match OD" by @ikevin127 (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #79273 introduced auto-redistribution logic for split expenses that does not properly handle edge cases when the user input is invalid (e.g., just a negative sign "-").

    Labels: Keeping DeployBlockerCash (frontend bug blocks App deploy), removing DeployBlocker (not a backend issue)

    📋 Detailed Analysis

    Evidence

    The issue reports that when splitting a negative expense and clearing a split amount field while leaving just the negative sign "-", the other split amount field changes to NaN instead of updating to the total amount.

    PR #79273 was specifically called out in the issue as being caught during regression testing. The PR introduced new auto-redistribution logic for split expenses that automatically updates unedited splits when one split is modified.

    Verification

    The bug occurs in the split expense flow, specifically when editing split amounts. PR #79273 modified:

    • src/libs/actions/IOU/index.ts - Added updateSplitExpenseAmountField with redistribution logic
    • src/components/MoneyRequestAmountInput.tsx - Added allowNegativeInput prop
    • src/components/NumberWithSymbolForm.tsx - Added logic to handle negative input
    • src/components/SelectionList/ListItem/SplitListItem/SplitAmountInput.tsx - Enabled allowNegativeInput

    Root Cause

    When a user clears a split amount field and leaves only the negative sign "-", the input validation in MoneyRequestUtils.ts validateAmount() function allows "-" as a valid input (line 51):

    if (shouldAllowNegative) {
        return amount === '' || amount === '-' || decimalNumberRegex.test(amount);
    }

    However, when this "-" value is parsed as a number in SplitExpensePage.tsx line 246-254, it becomes NaN. The convertToBackendAmount(NaN) returns NaN, which is then passed to updateSplitExpenseAmountField().

    The new redistribution logic in PR #79273 calculates the remaining amount and tries to redistribute it among unedited splits:

    const remaining = total - editedSum;  // If editedSum contains NaN, remaining becomes NaN
    const newAmount = calculateIOUAmount(lastUneditedIndex, remaining, currency, isLast, true);

    When remaining is NaN, all redistributed amounts become NaN, causing the UI to display "NaN" in the other split amount fields.

    This edge case was not handled in the PR, and the existing validation that allows "-" as an intermediate input state combined with the new auto-redistribution logic creates this bug.

  7. removed
    DeployBlockerIndicates it should block deploying the API
    on Feb 3, 2026
  8. ikevin127 commented on Feb 3, 2026

    @ikevin127
    Contributor

    🟢 Follow-up PR #81245 open for review! Hopefully we can avoid a revert 🤞

  9. blimpich commented on Feb 3, 2026

    @blimpich
    Contributor

    Reverted PR and am in the process of retesting. 3 deploy blockers present so went with revert instead of fix.

  10. m-natarajan commented on Feb 3, 2026

    @m-natarajan

    Unable to edit the split amount, Windows 10 / Chrome
    v9.3.11-38

    repro.-.issue.81241.-.can.t.edit.mp4
  11. blimpich commented on Feb 3, 2026

    @blimpich
    Contributor

    ^ this is same behavior on prod, not a blocker

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.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions