Skip to content

[$250] Distance - Error when deleting unedited split after editing the other split #83514

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.26-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: #82257
Email or phone of affected tester (no customers): sodijnoisdnjoinjsionjsio@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:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create a manual distance expense.
  4. Open the expense.
  5. Click More > Split > Save.
  6. Open any split.
  7. Click Distance.
  8. Change the distance and save it.
  9. Open the unedited split.
  10. Click More > Delete > Delete.

Expected Result:

The unedited split can be deleted.

Actual Result:

The unedited split cannot be deleted.
Error shows up.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7088598_1772050131924.111.mp4
Bug7088598_1772049887035.11.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @hoangzinh
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022026837030460461987
  • Upwork Job ID: 2026837030460461987
  • Last Price Increase: 2026-02-26

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 26, 2026
  2. melvin-bot commented on Feb 26, 2026

    @melvin-bot

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

  3. melvin-bot commented on Feb 26, 2026

    @melvin-bot

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

  4. melvin-bot commented on Feb 26, 2026

    @melvin-bot

    Triggered auto assignment to @JmillsExpensify (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 26, 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 26, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #82257 - "feat: handle the Distance and Rate fields for splits" by @ZhenjaHorbach (High confidence)
    Related Issues: Part of a larger feature to support distance fields in split expenses

    Recommendation: REVERT

    This PR introduced a new feature for handling distance and rate fields in split expenses, which appears to have broken the delete functionality for unedited splits. Given this is a new feature that doesn't exist in production (as noted in the issue: "N/A - new feature, doesn't exist in prod"), reverting is the safest approach to unblock the deploy while the author investigates the root cause.

    Labels: Removed DeployBlocker (backend deploy is not blocked). Kept DeployBlockerCash (App deploy remains blocked until this is fixed or the causing PR is reverted).

    📋 Detailed Analysis

    Evidence

    PR #82257 was merged on 2026-02-24 and is the only PR in the staging deploy that modified split expense handling for distance requests. The bug specifically involves:

    1. Creating a manual distance expense
    2. Splitting it
    3. Editing the distance on one split
    4. Attempting to delete the unedited split

    This exact workflow was introduced by this PR, which added support for distance/rate fields on split expenses.

    Verification

    The PR modified the following key files related to split expense handling:

    • src/libs/actions/IOU/Split.ts - Core split expense logic (326 additions, 37 deletions)
    • src/libs/actions/IOU/index.ts - Money request handling (20 additions, 1 deletion)
    • src/libs/TransactionUtils/index.ts - Transaction utilities (51 additions, 5 deletions)
    • src/pages/iou/SplitExpensePage.tsx - Split expense UI

    Key changes include:

    • Added customUnit, waypoints, odometerStart, odometerEnd to split expense data structure
    • New function updateSplitExpenseDistanceFromAmount() to calculate distance from amount
    • Modified initSplitExpense() to calculate customUnit and merchant for distance splits
    • Added distance-specific fields to SplitTransactionParams

    Root Cause

    When a distance expense is split, PR #82257 now populates distance-specific fields (customUnit, waypoints, etc.) for each split. The workflow in the bug report:

    1. Create splits: Both splits get customUnit with calculated quantity (distance) based on split amounts
    2. Edit one split's distance: Updates that split's customUnit.quantity and merchant
    3. Delete the unedited split: Fails with an error

    The issue appears to be that when deleting the unedited split, the transaction data structure or validation logic encounters an issue with the customUnit / distance fields that were added by this PR. The delete logic in updateSplitTransactions() calls getDeleteTrackExpenseInformation() for splits being removed, but may not properly handle the new distance-specific fields, especially when one split has been edited and another has not.

    Specifically, looking at lines 1363-1404 in Split.ts, the delete logic iterates through undeletedTransactions (splits being removed) and calls getDeleteTrackExpenseInformation(), but this logic may not account for the new customUnit structure that this PR added for distance transactions.

  7. 4 remaining items

  8. melvin-bot commented on Feb 26, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (External)

  9. changed the title [-]Distance - Error when deleting unedited split after editing the other split[/-] [+][$250] Distance - Error when deleting unedited split after editing the other split[/+] on Feb 26, 2026
  10. melvin-bot commented on Feb 26, 2026

    @melvin-bot
  11. hoangzinh commented on Feb 26, 2026

    @hoangzinh
    Contributor

    cc @ZhenjaHorbach @suneox, are you available to take a look at this DB? #83514 (comment)

  12. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 26, 2026
  13. suneox commented on Feb 26, 2026

    @suneox
    Contributor

    I think this is a BE issue

    83514.1.mp4

    api/RevertSplitTransaction response

    {
      "code": 666,
      "jsonCode": 666,
      "type": "Expensify\\Libs\\Error\\ExpError",
      "UUID": "CC8A6F15-8EBA-46CC-9F83-B42659C6D224",
      "message": "This transaction is not a split transaction",
      "title": "",
      "data": {
        ....
      ],
      "requestID": "9d3faa904b940f04-LAX"
    }
  14. lakchote commented on Apr 14, 2026

    @lakchote
    Contributor

    Issue not repro anymore

    Screen.Recording.2026-04-14.at.19.44.49.mov

    Closing.

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.EngineeringExternalAdded to denote the issue can be worked on by a contributorHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions