Skip to content

[$175] Split - Expense is labelled Split but does not act as a split expense after unapproving & retracting #106633

Open

Description

@vincdargento

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: v9.5.36-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://github.com/Expensify/Expensify/issues/613608
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create an expense in workspace chat.
  3. Open the expense report.
  4. Click More > Split > Save.
  5. Open any split.
  6. Click Report.
  7. Click Create report.
  8. On the current split, click Submit and Approve.
  9. Open the split which is moved to a new report from Step 7.
  10. Click Amount.
  11. Click on the highlighted split > click Remove split > Save.
  12. Open the approved report from Step 8.
  13. Click More > Unapprove.
  14. Click More > Retract
  15. Click More.
  16. Click Amount field.

Expected Result:

In Step 15, Edit split option should be shown because Amount field has "Split" label which means it is a split expense.

In Step 16, Amount field will open split details page.

Actual Result:

In Step 15, Split option is shown when Amount field has "Split" label. It opens split page which means the expense is not a split despite "Split" label on Amount field.

In Step 16, Amount field opens split initial page despite it is labelled a "Split".

Workaround:

N/A

Platforms:

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

Screenshots/Videos

Bug7288763_1792213278958.Screen_Recording_2026-10-17_at_12.56.19.mp4
Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @ZhenjaHorbach

Activity

  1. added
    Daily
    Bug
    on Nov 11, 2026
  2. added
    External
    on Nov 11, 2026
  3. melvin-bot commented on Nov 11, 2026

    @melvin-bot

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

  4. changed the title [-]Split - Expense is labelled Split but does not act as a split expense after unapproving & retracting[/-] [+][$175] Split - Expense is labelled Split but does not act as a split expense after unapproving & retracting[/+] on Nov 11, 2026
  5. melvin-bot commented on Nov 11, 2026

    @melvin-bot
  6. MelvinBot commented on Nov 11, 2026

    @MelvinBot
    Contributor

    🤖 Web test steps verification results: ⚠️ partial

    Verified on dev NewDot web. Created a workspace and opened its expense chat, but dialog hit-testing blocked expense setup; issue 106633 could not be assessed.

    Location access dialog blocking expense setup

    Step Status
    1. Open web sessionAuthenticated dev session accessible.
    ✅
    2. Create workspace expenseLocation-access dialog blocked automation; no expense saved.
    Location access dialog blocking expense setup
    ⚠️
    3. Open expense reportBlocked: no expense created.
    ⚠️
    4. More → Split → SaveBlocked by expense setup.
    ⚠️
    5. Open a splitNo splits created.
    ⚠️
    6. Click ReportRequires a split.
    ⚠️
    7. Create reportRequires the preceding step.
    ⚠️
    8. Submit and approveRequired report unavailable.
    ⚠️
    9. Open moved splitNo split moved.
    ⚠️
    10. Click AmountRequired split unavailable.
    ⚠️
    11. Remove highlighted split → SaveNo split exists.
    ⚠️
    12. Open approved reportNo approved report exists.
    ⚠️
    13. UnapproveRequires an approved report.
    ⚠️
    14. RetractRequired report state unavailable.
    ⚠️
    15. Inspect More menuNeither report-level nor transaction-level menu could be assessed.
    ⚠️
    16. Inspect Amount label and destinationRequired surviving split unavailable.
    ⚠️

    Proposal

    What is the root cause of that problem?

    Medium confidence: inconsistent definitions of an existing split. The code explains both reported symptoms, but runtime confirmation remains blocked.

    Removing the editable split while its sibling is approved intentionally preserves the approved sibling as a single remaining split. After retracting its report:

    • Amount shows “Split” because the expense retains split metadata and its report is open.
    • Report-level More requires multiple remaining splits, so it shows “Split,” not “Edit splits.”
    • Split initialization also requires multiple splits, so clicking Amount starts fresh split creation instead of opening existing details.
    Code evidence and hypothesis checks

    Alternative checked: this need not be stale rendering—the predicates disagree deterministically. However, the transaction-thread menu uses Amount’s broader condition, unlike the report-level menu. Reproduction must confirm which menu is involved and whether the server preserves the remaining split’s metadata.

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

    Use one shared definition of an existing split family across Amount, both More menus, and split initialization. A retained family containing one active split should open its existing details, rather than generate two new splits.

    Preserve approved-expense protections; do not force reversal or simply clear split metadata.

    Feasibility and regression coverage

    The existing-details page already supports one remaining child, and unchanged Save exits without writing.

    Cover the exact reported sequence, both menus, unchanged Save, edited-singleton Save, and ordinary multi-split behavior. Preserve the approved-singleton non-reversion tests.

    Before implementation, confirm the server retains the single-child family after removal and retract.

    What alternative solutions did you explore? (Optional)

    Removing the “Split” label would align with current navigation, but would not meet the issue’s expected existing-details behavior. Renaming the menu alone would leave navigation broken.


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


    view run · view recording

  7. kevinjosh10 commented on Nov 11, 2026

    @kevinjosh10

    Proposal

    What is the root cause of that problem?

    There is a logic mismatch across components and action files regarding how an existing split expense is detected when only one split child remains on an open report:

    1. Amount Field & Header Actions:
      In MoneyRequestView.tsx:427–429 and MoneyRequestHeaderSecondaryActions.tsx:263–265:

      const hasMultipleSplits = useHasMultipleSplitChildren(transaction?.comment?.originalTransactionID);
      const isReportOpen = isOpenReport(moneyRequestReport);
      const shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen);

      Because isReportOpen is true, shouldShowSplitIndicator evaluates to true. Thus, the Amount field renders the "Split" label and delegates its onPress to initSplitExpense.

    2. Report More Menu:
      In src/hooks/useExpenseActions.ts:211–212:

      const hasMultipleSplits = !!transaction?.comment?.originalTransactionID && getChildTransactions(allTransactions, transaction.comment.originalTransactionID).length > 1;
      const hasSplitIndicator = isExpenseSplit && hasMultipleSplits;

      hasSplitIndicator strictly checks hasMultipleSplits and omits || isOpenReport(moneyRequestReport). Because only 1 split remains in the family (getChildTransactions.length === 1), hasSplitIndicator evaluates to false. Therefore, in useExpenseActions.ts:360, the menu displays translate('iou.split') ("Split") instead of translate('iou.editSplits') ("Edit splits").

    3. Split Initialization Action:
      In src/libs/actions/SplitExpenses.ts:86–88:

      const relatedTransactions = getChildTransactions(allTransactions, originalTransactionID);
      const hasMultipleSplits = relatedTransactions.length > 1;
      const shouldShowSplitIndicator = isExpenseSplit && hasMultipleSplits;

      initSplitExpense also only checks hasMultipleSplits. Because hasMultipleSplits is false, it fails the check if (isExpenseSplit && shouldShowSplitIndicator) at line 103 and falls through to lines 153–185. It calculates new 50/50 split amounts (calculateAmount(1, transactionDetailsAmount, ...)) and navigates to the new split wizard instead of populating SPLIT_TRANSACTION_DRAFT with the existing split item and navigating to the existing split overview.

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

    1. Align SplitExpenses.ts (initSplitExpense):
      In src/libs/actions/SplitExpenses.ts, compute isReportOpen and include it in shouldShowSplitIndicator:

      const isReportOpen = isOpenReport(report) || isOpenReport(parentReport) || isOpenReport(transactionReport);
      const shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen);

      When isExpenseSplit && shouldShowSplitIndicator is true, initSplitExpense populates SPLIT_TRANSACTION_DRAFT with the existing split child data and navigates to the split overview screen (DYNAMIC_ROUTES.MONEY_REQUEST_SPLIT_EXPENSE), displaying the existing split item and allowing the user to view, edit, or add more splits.

    2. Align useExpenseActions.ts:
      In src/hooks/useExpenseActions.ts, include isOpenReport(moneyRequestReport) in hasSplitIndicator:

      const isReportOpen = isOpenReport(moneyRequestReport);
      const hasSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen);

      This ensures the report-level More menu displays "Edit splits" (translate('iou.editSplits')) whenever the split indicator is active.

    3. Unit Tests:
      Add unit test coverage in tests/actions/IOUTest/SplitTest.ts to verify that when a single split item remains after unapproving/retracting an expense report:

      • initSplitExpense initializes the existing split draft instead of creating a fresh 50/50 split.
      • The action text displays "Edit splits" when the report is open.

    What alternative solutions did you explore? (Optional)

    • Reverting the single split to an ordinary transaction upon retracting: Rejected because report retraction only transitions workflow status and should not destructively mutate transaction structures or lose originalTransactionID lineage.
    • Removing the "Split" label from the Amount field: Rejected because the transaction is an existing split child whose parent and siblings exist in backend history; treating it as an un-split transaction introduces state inconsistency.

    Contributor details

    Your Expensify account email: lkevinjosh10@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374

  8. melvin-bot commented on Nov 11, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  9. HindsightWise commented on Nov 11, 2026

    @HindsightWise

    Proposal

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

    When an expense is split into two parts across two reports, one report is submitted and approved, the second split is removed via Remove split > Save, and the first report is then unapproved and retracted back to an open (Draft) state:

    1. On the expense's detail view (MoneyRequestView), the Amount row displays the • Split indicator, and the transaction thread's More menu (MoneyRequestHeaderSecondaryActions) shows Edit splits.
    2. However, on the expense report view, selecting the expense and opening the More dropdown (useExpenseActions) shows Split instead of Edit splits.
    3. Clicking Split in that report More dropdown (or tapping the Amount row on the expense detail view) calls initSplitExpense, which treats the remaining split child as an unsplit expense and splits it in half again (creating two new draft child splits with the child's transactionID as their originalTransactionID) instead of opening the existing split details editor (DYNAMIC_ROUTES.MONEY_REQUEST_SPLIT_EXPENSE).

    What is the root cause of that problem?

    1. When the second split on Report 2 is removed in Step 11 while Report 1 is still Approved, updateSplitTransactions (src/libs/actions/IOU/SplitTransactionUpdate.ts:441-442) checks:
      const hasEditableSplitExpensesLeft = hasEditableSplitExpenseLeft(splitExpenses, allTransactionsList, allReportsList, currentSnapshotDataForSplits);
      const isReverseSplitOperation = splitExpenses.length === 1 && allChildTransactions.length > 0 && hasEditableSplitExpensesLeft;
      Because the remaining split on Report 1 is on an approved report (statusNum >= SUBMITTED), hasEditableSplitExpensesLeft is false, so isReverseSplitOperation does not revert the split back to a regular transaction. The remaining expense on Report 1 keeps comment.source === CONST.IOU.TYPE.SPLIT and comment.originalTransactionID, and becomes the sole remaining child transaction (getChildTransactions(allTransactions, originalTransactionID).length === 1, so hasMultipleSplits === false).
    2. When Report 1 is subsequently unapproved and retracted (Steps 13–14), isOpenReport(moneyRequestReport) becomes true.
    3. In PR #91549 ("Show split label if there is at least one split in open report"), all four split-indicator call sites were updated to check isExpenseSplit && (hasMultipleSplits || isReportOpen). However, when PR #91995 (commit fdf45b46a1ed) later removed the temporary !isProduction guard from those files, || isReportOpen was preserved in MoneyRequestView.tsx and MoneyRequestHeaderSecondaryActions.tsx, but was accidentally dropped from src/hooks/useExpenseActions.ts and src/libs/actions/SplitExpenses.ts:
      • In src/components/ReportActionItem/MoneyRequestView.tsx:427-429 and src/components/MoneyRequestHeaderSecondaryActions.tsx:263-265:
        const hasMultipleSplits = useHasMultipleSplitChildren(transaction?.comment?.originalTransactionID);
        const isReportOpen = isOpenReport(moneyRequestReport);
        const shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen);
      • In src/hooks/useExpenseActions.ts:210-212:
        const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(transaction, originalTransaction);
        const hasMultipleSplits = !!transaction?.comment?.originalTransactionID && getChildTransactions(allTransactions, transaction.comment.originalTransactionID).length > 1;
        const hasSplitIndicator = isExpenseSplit && hasMultipleSplits;
        Because isOpenReport(moneyRequestReport) is missing here, hasSplitIndicator evaluates to false, causing the report More menu (src/hooks/useExpenseActions.ts:227) to label the action translate('iou.split') ("Split") instead of translate('iou.editSplits') ("Edit splits").
      • In src/libs/actions/SplitExpenses.ts:85-88, 103 (initSplitExpense):
        const relatedTransactions = getChildTransactions(allTransactions, originalTransactionID);
        const hasMultipleSplits = relatedTransactions.length > 1;
        const transactionReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`];
        const shouldShowSplitIndicator = isExpenseSplit && hasMultipleSplits;
        Even though transactionReport is already looked up on line 87, isOpenReport(transactionReport) is missing from shouldShowSplitIndicator on line 88. Consequently, if (isExpenseSplit && shouldShowSplitIndicator) at line 103 is skipped, and initSplitExpense falls through to the new-split branch (lines 153–246), splitting the already-split child transaction into two new half-amount draft splits instead of opening the existing split expense editor for originalTransactionID.

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

    Restore the isOpenReport check in src/hooks/useExpenseActions.ts and src/libs/actions/SplitExpenses.ts (and align src/hooks/useSelectedTransactionsActions.ts) so that all split-indicator and initSplitExpense checks use the exact same isExpenseSplit && (hasMultipleSplits || isReportOpen) condition as MoneyRequestView.tsx and MoneyRequestHeaderSecondaryActions.tsx:

    1. src/hooks/useExpenseActions.ts (lines 210–213):
      Include isOpenReport(moneyRequestReport) in hasSplitIndicator:

      const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(transaction, originalTransaction);
      const hasMultipleSplits = !!transaction?.comment?.originalTransactionID && getChildTransactions(allTransactions, transaction.comment.originalTransactionID).length > 1;
      const isReportOpen = isOpenReport(moneyRequestReport);
      const hasSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen);
    2. src/libs/actions/SplitExpenses.ts (lines 85–89):
      Import isOpenReport from @libs/ReportUtils and include isOpenReport(transactionReport) in shouldShowSplitIndicator:

      const relatedTransactions = getChildTransactions(allTransactions, originalTransactionID);
      const hasMultipleSplits = relatedTransactions.length > 1;
      const transactionReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`];
      const isReportOpen = isOpenReport(transactionReport);
      const shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen);

      With shouldShowSplitIndicator evaluating to true, initSplitExpense enters if (isExpenseSplit && shouldShowSplitIndicator) (line 103), populates the draft split list from relatedTransactions against the original originalTransactionID, and navigates to DYNAMIC_ROUTES.MONEY_REQUEST_SPLIT_EXPENSE.getRoute(reportID, originalTransactionID, transaction.transactionID) instead of creating nested splits.

    3. src/hooks/useSelectedTransactionsActions.ts (lines 496–502):
      For consistency with useExpenseActions.ts, also include isOpenReport(moneyRequestReport) when checking whether a selected transaction already has a split indicator:

      const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(selectedTransaction, originalTransaction);
      const originalTransactionID = selectedTransaction?.comment?.originalTransactionID;
      const hasMultipleSplits = !!originalTransactionID && getChildTransactions(allTransactions, originalTransactionID).length > 1;
      const isReportOpen = isOpenReport(moneyRequestReport);
      canSplitTransaction = !(isExpenseSplit && (hasMultipleSplits || isReportOpen));
    4. Unit Tests:
      Add unit tests in tests/actions/IOU/SplitTest.ts and tests/unit/useExpenseActionsTest.ts verifying that when a single remaining split child is on an open report (stateNum: CONST.REPORT.STATE_NUM.OPEN, statusNum: CONST.REPORT.STATUS_NUM.OPEN), useExpenseActions returns the Edit splits (iou.editSplits) option and initSplitExpense opens the existing split editor for originalTransactionID rather than creating two new half-amount split children.

    What alternative solutions did you explore? (Optional)

    We also considered hiding the • Split indicator everywhere when relatedTransactions.length === 1 even on an open report (shouldShowSplitIndicator = isExpenseSplit && hasMultipleSplits). However, PR #91549 intentionally kept the • Split indicator and Edit splits behavior on open reports with a single split so users can still inspect the original split total and add/adjust splits while the report is open, and MoneyRequestView.tsx and MoneyRequestHeaderSecondaryActions.tsx already implement isExpenseSplit && (hasMultipleSplits || isReportOpen). Restoring || isReportOpen in useExpenseActions.ts and SplitExpenses.ts directly fixes the regression from PR #91995 and keeps all surfaces consistent.


    Contributor details

    — submitted with Antigravity on the contributor's behalf

  10. Stephen3453 commented on Nov 11, 2026

    @Stephen3453

    Proposal

    What is the root cause of that problem?

    The "is this an existing split" rule is written out separately in four places, and two of them disagree with the other two. MoneyRequestView.tsx:427-429 (the Amount label and its onPress) uses isExpenseSplit && (hasMultipleSplits || isReportOpen). useExpenseActions.ts:210-212 (the report More menu text) uses only isExpenseSplit && hasMultipleSplits. initSplitExpense in src/libs/actions/SplitExpenses.ts (~lines 85-88, used at the if (isExpenseSplit && shouldShowSplitIndicator) branch) does the same, and it already reads transactionReport one line above without using it. After step 11 only one split child is left, because the approved sibling blocks the reverse-split. After Retract the report is open, so Amount says "Split" and calls initSplitExpense. That call sees hasMultipleSplits === false, skips the existing-details branch and builds a fresh 50/50 split. The More menu shows "Split" for the same reason. I read all three files. I could not run the app.

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

    Fix it once instead of patching each copy. Add one helper, for example shouldShowSplitIndicator(isExpenseSplit, childCount, report) in src/libs/TransactionUtils, returning isExpenseSplit && (childCount > 1 || isOpenReport(report)). Call it from MoneyRequestView.tsx, useExpenseActions.ts (with moneyRequestReport), initSplitExpense (with transactionReport, which is already looked up) and useSelectedTransactionsActions.ts. The next surface cannot drift again, and a closed report with one split child still behaves as before.
    Test in tests/actions/IOUTest/SplitTest.ts: one child with originalTransactionID on an open report. Assert that initSplitExpense sets SPLIT_TRANSACTION_DRAFT from the existing child and navigates to MONEY_REQUEST_SPLIT_EXPENSE. Then repeat with the report approved and assert it does not. Add one useExpenseActions test that the label is iou.editSplits.

    What alternative solutions did you explore? (Optional)

    kevinjosh10 and HindsightWise both add || isReportOpen inline in useExpenseActions.ts and SplitExpenses.ts. That is the same condition as mine, but it leaves four hand-copied conditions, which is how they diverged. MelvinBot's analysis finds the same mismatch but leaves the fix open, with a hedge about the server. A shared helper plus the two tests is the smaller long-term change. Removing the Amount "Split" label would contradict the open-report design and the issue's expected result.

  11. TassioSales commented on Nov 11, 2026

    @TassioSales

    Proposal

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

    When an expense is split across reports, and one of the split reports is subsequently unapproved and retracted, the retracted expense retains the "Split" label but fails to provide the "Edit split" option or behave as an editable split transaction.

    What is the root cause of that problem?

    In src/libs/ReportUtils.ts (isSplitBillAction), src/libs/SplitExpenseUtils.ts (isSplitExpenseFrozen), and src/libs/actions/IOU/ReportWorkflow.ts (retractReport / unapproveExpenseReport):

    1. When a split expense report is retracted via retractReport, the report action state is updated with hasReportBeenRetracted: true, but the linked transaction's split state metadata (transaction.comment.splits or parent transaction reference) is partially detached or marked as frozen because isSplitExpenseFrozen checks isReportApproved({report}) || isSettled(report) || isClosedReport(report).
    2. In ReportActionsUtils.ts and ReportUtils.ts, the action menu option evaluator checks whether the report or action allows split modifications. When unapproving and retracting, the report status reverts from APPROVED to OPEN/SUBMITTED, but the split bill controller continues to treat the split child as locked or non-split because the parent report action's childReportID association is not reconciled with the retracted report state.

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

    1. In src/libs/SplitExpenseUtils.ts (isSplitExpenseFrozen):
      • Ensure a report that has been unapproved or retracted (report.hasReportBeenRetracted or !isReportApproved({report}) && !isSettled(report)) is not treated as frozen, allowing the split amount and split participants to be edited.
    2. In src/libs/actions/IOU/ReportWorkflow.ts (unapproveExpenseReport and retractReport):
      • When resetting the report state on unapprove and retract, ensure the optimistic updates preserve the transaction's split relationships (comment.splits and splitPayerAccountIDs) and update the parent report action's metadata so that isSplitBillReportAction and the "Edit split" menu action remain active.
    3. In src/pages/iou/DynamicSplitExpensePage.tsx / SplitBillController.tsx:
      • Allow navigation to edit split details when the current report is in an unapproved or retracted state.

    What alternative solutions did you explore? (Optional)

    Completely recreating the split transaction upon retract, which would alter transaction history and timestamps unnecessarily.

  12. haiquywork commented on Nov 12, 2026

    @haiquywork

    Proposal

    What is the root cause of that problem?

    The UI and the action use two different definitions of "is a split". MoneyRequestView and MoneyRequestHeaderSecondaryActions compute shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen). After step 11 only one child is left, and after Unapprove and Retract the report is open, so the label and edit-splits menu item show. On press they call initSplitExpense, which uses a stricter check, shouldShowSplitIndicator = isExpenseSplit && hasMultipleSplits. With one child left that is false, so it skips the edit branch and builds a fresh two-way split draft, which is the initial split page. The isReportOpen clause is in the UI check but not in the action.

    const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(transaction, originalTransaction);
    const relatedTransactions = getChildTransactions(allTransactions, originalTransactionID);
    const hasMultipleSplits = relatedTransactions.length > 1;
    const transactionReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`];
    const shouldShowSplitIndicator = isExpenseSplit && hasMultipleSplits;
    const isSelfDMReport = isSelfDM(report) || isSelfDM(parentReport);
    let reportID: string;
    if (isSelfDMReport) {
    // If the report itself is selfDM, use its ID directly.
    // If only the parent is selfDM (e.g. user opened from a transaction thread inside selfDM),
    // use the selfDM parent report ID so the edit screen resolves the correct report name
    // instead of showing the transaction thread name (which uses the expense merchant).
    reportID = (isSelfDM(report) ? report?.reportID : parentReport?.reportID) ?? String(CONST.DEFAULT_NUMBER_ID);
    } else {
    reportID = transaction.reportID ?? String(CONST.DEFAULT_NUMBER_ID);
    }
    if (isExpenseSplit && shouldShowSplitIndicator) {

    const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(transaction, originalTransaction);
    const [transactionReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`);
    const hasMultipleSplits = useHasMultipleSplitChildren(transaction?.comment?.originalTransactionID);
    const isReportOpen = isOpenReport(moneyRequestReport);
    const shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen);

    const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(transaction, originalTransaction);
    const hasMultipleSplits = useHasMultipleSplitChildren(transaction?.comment?.originalTransactionID);
    const isReportOpen = isOpenReport(parentReport);
    const shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen);

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

    • In initSplitExpense (src/libs/actions/SplitExpenses.ts), use the same condition as the UI: isExpenseSplit && (hasMultipleSplits || isOpenReport(transactionReport)). The report is already looked up there as transactionReport.
    • Better, add one shared helper, for example shouldShowSplitIndicator(isExpenseSplit, hasMultipleSplits, report), next to getOriginalTransactionWithSplitInfo. Use it in MoneyRequestView, MoneyRequestHeaderSecondaryActions and initSplitExpense so they can't drift apart again.
    • Check useExpenseActions (hasSplitIndicator) and useSelectedTransactionsActions. They also use hasMultipleSplits alone, so they should use the helper too.
    • Unit test in tests/actions (SplitExpenses): a single remaining split child in an open expense report. Assert that initSplitExpense with navigateToEditSplitExpense writes the draft from the existing child and navigates to the edit-splits route, not a new 2-way split.

    What alternative solutions did you explore? (Optional)

    • Drop isReportOpen from the UI so a lone split child is no longer labelled "Split". This is worse: a user who left one split in an open report would lose the way to edit it, and that clause looks intentional.
  13. cocvn157 commented on Nov 13, 2026

    @cocvn157

    Proposal

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

    When an expense is split across two reports, one split report is submitted and approved, the sibling split on the other report is removed via Remove split > Save, and the approved report is then Unapproved and Retracted back to the open (Draft) state:

    1. Opening the report's More menu (Step 15) displays Split instead of Edit splits, even though the expense's Amount row displays the Split indicator.
    2. Clicking Amount on the expense view (Step 16) or selecting Split from the report's More menu opens the initial 50/50 new-split flow (creating nested child splits from the remaining split child) instead of opening the existing split details page (DYNAMIC_ROUTES.MONEY_REQUEST_SPLIT_EXPENSE).

    What is the root cause of that problem?

    1. Why a single split child legitimately remains on the report:
      When the sibling split is removed in Step 11 while the first split's report is Approved, updateSplitTransactions (src/libs/actions/IOU/SplitTransactionUpdate.ts:441-442) checks:

      const hasEditableSplitExpensesLeft = hasEditableSplitExpenseLeft(splitExpenses, allTransactionsList, allReportsList, currentSnapshotDataForSplits);
      const isReverseSplitOperation = splitExpenses.length === 1 && allChildTransactions.length > 0 && hasEditableSplitExpensesLeft;

      Because the surviving split is on an approved report (statusNum >= SUBMITTED), hasEditableSplitExpensesLeft is false, so isReverseSplitOperation intentionally preserves it as a split child (comment.source === CONST.IOU.TYPE.SPLIT and comment.originalTransactionID). At that point getChildTransactions(allTransactions, originalTransactionID) has length 1 (hasMultipleSplits === false).

    2. Predicate divergence introduced by commit 5bfb8e2b40 (PR #84382):
      PR #91549 (7a059f4f1f) intentionally kept a single surviving split child editable as an existing split whenever its expense report is open (hasMultipleSplits || isReportOpen). Later, commit 5bfb8e2b40 ("Fix bug with removed perDiem selfDM splits in offline mode" in PR #84382) removed isOpenReport(...) from src/hooks/useExpenseActions.ts and src/libs/actions/SplitExpenses.ts while leaving it in MoneyRequestView.tsx and MoneyRequestHeaderSecondaryActions.tsx:

      • UI label & thread menu (src/components/ReportActionItem/MoneyRequestView.tsx:429-431 and src/components/MoneyRequestHeaderSecondaryActions.tsx:269-271): check isExpenseSplit && (hasMultipleSplits || isReportOpen). Once the report is unapproved and retracted, isReportOpen is true, so Amount renders the Split indicator and delegates onPress to initSplitExpense.
      • Report-level More menu (src/hooks/useExpenseActions.ts:212-214, 366): checks only const hasSplitIndicator = isExpenseSplit && hasMultipleSplits;, so with 1 child left it renders translate('iou.split') ("Split") instead of translate('iou.editSplits') ("Edit splits"). In addition, hasSplitIndicator at line 212 inspects transaction (derived from iouTransactionID via reportActions), whereas actions[SPLIT].onSelected at line 375 passes currentTransaction (transactions.at(0) from reportTransactions), which can disagree before paginated reportActions finish loading (e.g. when opening from Search).
      • Split initializer (src/libs/actions/SplitExpenses.ts:85-88, 103): checks only const shouldShowSplitIndicator = isExpenseSplit && hasMultipleSplits;. With relatedTransactions.length === 1, it skips if (isExpenseSplit && shouldShowSplitIndicator) at line 103 and falls through to lines 153-246, splitting the surviving split child into two new 50/50 child drafts keyed by transaction.transactionID instead of populating SPLIT_TRANSACTION_DRAFT for originalTransactionID.
      • Table-view selection menu (src/hooks/useSelectedTransactionsActions.ts:582-586): similarly gates canSplitTransaction on !(isExpenseSplit && hasMultipleSplits), allowing a contradictory fresh Split bulk action when that single split child is selected on an open expense report.
    3. Why naive isOpenReport(...) checks regress self-DM, Search snapshots, or approved reports:

      • isOpenReport(report) (src/libs/ReportUtils.ts:2111) only checks stateNum === OPEN && statusNum === OPEN without checking report.type. Both selfDM and transactionThreadReport are chat reports whose stateNum and statusNum are 0 (OPEN). Passing report (transactionThreadReport) or parentReport (selfDM) to isOpenReport in initSplitExpense evaluates to true even when the underlying expense report is Approved/Settled (breaking approved-singleton behavior) or when a self-DM Per Diem split was dissolved offline (relatedTransactions.length === 0 after pendingAction: DELETE, producing an empty splitExpenses: [] draft — the exact scenario commit 5bfb8e2b40 guarded against).
      • Conversely, checking only allReports['report_' + transaction.reportID] misses open expense reports opened from Search when the report record is passed in via props/snapshot before ONYXKEYS.COLLECTION.REPORT is hydrated (as documented in tests/actions/IOUTest/SplitTest.ts:4067-4101).

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

    1. Add a shared helper shouldTreatAsExistingSplitExpense in src/libs/TransactionUtils/index.ts:
      Centralize the collection-backed check using isOpenExpenseReport (src/libs/ReportUtils.ts:1634, which verifies isExpenseReport(report) && stateNum === OPEN && statusNum === OPEN) and requiring at least one non-deleted split child (childCount > 0):

      function shouldTreatAsExistingSplitExpense(
          transaction: OnyxEntry<Transaction>,
          originalTransaction: OnyxEntry<Transaction>,
          allTransactions: OnyxCollection<Transaction>,
          expenseReport: OnyxEntry<Report>,
      ): boolean {
          const {isExpenseSplit: isSplit} = getOriginalTransactionWithSplitInfo(transaction, originalTransaction);
          if (!isSplit) {
              return false;
          }
          const childCount = getChildTransactions(allTransactions, transaction?.comment?.originalTransactionID).length;
          if (childCount === 0) {
              return false;
          }
          return childCount > 1 || isOpenExpenseReport(expenseReport);
      }
    2. Use shouldTreatAsExistingSplitExpense in src/libs/actions/SplitExpenses.ts (initSplitExpense):
      Resolve the expense report across Onyx and the passed report/parentReport (without matching chat / transactionThread / selfDM reports, since isOpenExpenseReport checks isExpenseReport):

      const transactionReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`];
      const resolvedExpenseReport = transactionReport ?? (isExpenseReport(report) ? report : parentReport);
      const shouldShowSplitIndicator = shouldTreatAsExistingSplitExpense(transaction, originalTransaction, allTransactions, resolvedExpenseReport);

      When shouldShowSplitIndicator is true, initSplitExpense enters the existing-split branch at line 103, initializes SPLIT_TRANSACTION_DRAFT with the surviving split child under originalTransactionID (preserving the original split parent amount), and navigates to DYNAMIC_ROUTES.MONEY_REQUEST_SPLIT_EXPENSE.

    3. Align src/hooks/useExpenseActions.ts and src/hooks/useSelectedTransactionsActions.ts:

      • In src/hooks/useExpenseActions.ts: resolve const splitTargetTransaction = transaction ?? singleTransaction; (looking up its originalTransaction) so hasSplitIndicator and actions[SPLIT].onSelected always evaluate the same transaction, and compute:
        const hasSplitIndicator = shouldTreatAsExistingSplitExpense(splitTargetTransaction, splitOriginalTransaction, allTransactions, moneyRequestReport);
        so the report More menu displays Edit splits (translate('iou.editSplits')).
      • In src/hooks/useSelectedTransactionsActions.ts: replace !(isExpenseSplit && hasMultipleSplits) in canSplitTransaction with !shouldTreatAsExistingSplitExpense(firstTransaction, originalTransaction, allTransactions, report).
    4. Unit Tests:

      • In tests/actions/IOUTest/SplitTest.ts: verify that for a single remaining split child on an open expense report (after unapproving & retracting, including when the report is passed directly without ONYXKEYS.COLLECTION.REPORT), initSplitExpense populates SPLIT_TRANSACTION_DRAFT under originalTransactionID and navigates to MONEY_REQUEST_SPLIT_EXPENSE; verify that on an approved expense report (even when report is a chat transaction thread) or an offline-removed self-DM Per Diem split (childCount === 0), it does not.
      • In tests/unit/useExpenseActionsTest.ts and tests/unit/hooks/useSelectedTransactionsActions.test.ts: verify Edit splits is shown in the report More menu and fresh Split is suppressed in bulk selection for a single split child on an open expense report.

    What alternative solutions did you explore? (Optional)

    • Hiding the Split label on MoneyRequestView when only one split child remains on an open report: Rejected because PR #91549 intentionally preserved the Split indicator on open expense reports so users can still inspect the original parent total and edit/re-add splits, and the expected result requires Edit splits and opening the split details page.
    • Reverting the surviving split child into a regular expense during retractReport: Rejected because retractReport only transitions workflow state and should not destructively rewrite split lineage (originalTransactionID) or alter parent transaction amounts.
  14. 5 remaining items

  15. ahmedGaber93 commented on Nov 20, 2026

    @ahmedGaber93
    Contributor

    Please also share the required changes from the backend.

    @MelvinBot I don't have access to this repository. I'm only asking for clarification on the expected changes to the backend response.

  16. melvin-bot commented on Nov 20, 2026

    @melvin-bot

    @ahmedGaber93 Use the Connect GitHub link in our earlier Slack DM. I will continue the original request once you are connected.

  17. ahmedGaber93 commented on Nov 20, 2026

    @ahmedGaber93
    Contributor

    @MelvinBot could you please send me new connect link on slack, I got this error

    Let’s try a fresh link
    This connection link has expired. Head back to Slack and ask me to “connect github”.
    
    Screenshot 2026-11-20 at 3 19 46 AM
  18. melvin-bot commented on Nov 20, 2026

    @melvin-bot

    @ahmedGaber93 I sent you a Slack DM to connect GitHub. I will continue the original request once you are connected.

  19. MelvinBot commented on Nov 20, 2026

    @MelvinBot
    Contributor

    Please send connect github in our Slack DM to request a fresh link. I can’t generate or send a new connection link from this GitHub thread.


    view run

  20. ahmedGaber93 commented on Nov 20, 2026

    @ahmedGaber93
    Contributor

    @MelvinBot implement this

    Please also share the required changes from the backend.

  21. MelvinBot commented on Nov 20, 2026

    @MelvinBot
    Contributor

    Implementation blocked by conflicting expected behavior. No code changes or PR were created.

    The mismatch still exists: Amount’s indicator recognizes a single remaining split on an open report, but split initialization requires multiple children.

    However, an existing regression test explicitly requires an open singleton retaining split metadata to start a new split, not reopen existing details. The proposed shared predicate would reverse that expectation.

    Backend response clarification: No required backend change or new field has been established. For the proposed existing-details behavior, the client needs:

    • The surviving child’s split metadata and original-parent reference preserved.
    • The original parent and active child available.
    • The retracted expense report marked open.

    These are existing data expectations, not confirmed missing backend functionality. Actual server responses remain unverified.

    Decision needed: Should every open singleton retaining split metadata reopen Edit splits, superseding that regression test? If both behaviors must remain, we need a reliable distinction between a retained split family and a dissolved one before implementing the predicate.


    view run

  22. ahmedGaber93 commented on Nov 20, 2026

    @ahmedGaber93
    Contributor

    However, an existing regression test explicitly requires an open singleton retaining split metadata to start a new split, not reopen existing details. The proposed shared predicate would reverse that expectation.

    I think this looks coorect.

  23. ahmedGaber93 commented on Nov 20, 2026

    @ahmedGaber93
    Contributor

    The root cause apear in Retract step.

    When the other half was removed (step 11), the first half couldn't turn back into a full-amount expense, because its report was already approved. It stayed one half of a split.

    After Unapprove → Retract, the expense should come back as a normal expense, since it no longer has a sibling. Instead it comes back as a split. It keeps its split details (originalTransactionID and source: split), so the Amount field still says "Split". But there's only one child left, so the split flow starts a new split instead of opening Edit splits.

    I think the fix should be in the backend

    Screen.Recording.2026-11-20.at.5.01.28.AM.mov
  24. ahmedGaber93 commented on Nov 20, 2026

    @ahmedGaber93
    Contributor

    @lakchote Would you mind taking a look at this since It seems have the same context of #91104?

  25. lakchote commented on Nov 20, 2026

    @lakchote
    Contributor

    Yes, it's the same area. #91104 made a split with one expense left act like a normal expense, but it got reverted in #91549 because of #91481.

    Right now, initSplitExpense counts every split half, unreported ones included, and only opens Edit splits when more than one is left. MoneyRequestView and MoneyRequestHeaderSecondaryActions count only the halves on a report, and they also show "Split" whenever the report is open. That's why Amount says "Split" here but then starts a new split.

    So I think we can fix this on the frontend by making those two use the same check as initSplitExpense, without a backend change. We'd need to keep #91481 in mind though, since that's what came up last time.

    @ZhenjaHorbach #91995 dropped the open-report check from initSplitExpense and useExpenseActions, but MoneyRequestView and MoneyRequestHeaderSecondaryActions still have it. Since you built splits for unreported expenses in #84382, can you take this one?

  26. ZhenjaHorbach commented on Nov 20, 2026

    @ZhenjaHorbach
    Contributor

    I will check!

  27. expensify-chore-bot commented on Nov 23, 2026

    @expensify-chore-bot

    @ZhenjaHorbach Whoops! This issue is 2 days overdue. Let's get this updated quick!

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

Metadata

Metadata

Labels

BugDailyExternalOverdue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions