Skip to content

[Due for payment 2026-05-20] [$250] Broken report page and report review after removing split #87094

Closed

Description

@m-natarajan

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.52-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @jnowakow
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Navigate to workspace chat and create report
  2. Add expense
  3. Split expense from step 2
  4. Open one of child expenses
  5. Click More > Edit splits
  6. Select one split
  7. Remove split

Expected Result:

Report should have expense details.

Actual Result:

Report page shows only amount. Preview is empty.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

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

Screenshots/Videos

remove-split-from-edit-splits.mov
Recording.2644.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022040074536357088393
  • Upwork Job ID: 2040074536357088393
  • Last Price Increase: 2026-04-10

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 3, 2026
  2. MelvinBot commented on Apr 3, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When a split is removed via "Edit splits" → "Remove split", the updateSplitTransactions function in Split.ts handles two paths: UPDATE (2+ splits remain) and REVERT (1 split remains). Both paths have a gap in how they update the report preview.

    UPDATE path (Split.ts:1930-1949): The original IOU action (firstIOU) in the expense report is optimistically deleted — its message.html is set to '', IOUTransactionID to null, and pendingAction to DELETE. The REPORT_PREVIEW action is updated via pushUpdatedReportPreviewActionToOnyxData (Split.ts:1221-1246), but this only updates metadata (childVisibleActionCount, childCommenterCount, etc.) — it does not update the preview's message text or amount.

    When getReportPreviewMessage (ReportUtils.ts:5380-5384) runs, it calls getLinkedTransaction(iouReportAction) to build the preview text. Since the deleted IOU action has IOUTransactionID: null, getLinkedTransaction returns empty, and the function falls back to reportActionMessage — which is also empty ('') because the action's message HTML was cleared. This produces the empty preview.

    For the report page itself, getDeleteTrackExpenseInformation (IOU/index.ts:3041-3059) sets the deleted child transaction to null in Onyx and its report action message to empty. This breaks the report page display for the deleted expense row, showing only the amount (from the report total) with no transaction details.

    REVERT path (Split.ts:2003-2066): The expense report is deleted (reportID: null) but — unlike the equivalent code in Search.ts:1063-1091 which properly marks the REPORT_PREVIEW action with pendingAction: DELETE — the Split.ts revert path does not mark the REPORT_PREVIEW for deletion. This leaves a REPORT_PREVIEW action pointing to a null/empty report, causing getReportPreviewMessage to hit the empty-report fallback at ReportUtils.ts:5373.

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

    1. Update the REPORT_PREVIEW message content during split updates: In updateSplitTransactions (Split.ts), after processing split removals, update the REPORT_PREVIEW action's message field (not just metadata) with the correct preview text reflecting the new report total and remaining transactions. This mirrors what deleteMoneyRequest does at IOU/index.ts:8140-8162 where it explicitly recomputes the preview message text using translateLocal('iou.payerOwesAmount', ...) and updates childMoneyRequestCount.

    2. Mark REPORT_PREVIEW for deletion in the revert path: In the reverse-split path (Split.ts:2003-2066), when isLastTransactionInReport is true, add pendingAction: DELETE to the REPORT_PREVIEW action — consistent with how Search.ts:1063-1091 handles the same operation.

    What alternative solutions did you explore? (Optional)

    An alternative would be to make getReportPreviewMessage more resilient to empty/deleted IOU actions by falling through to the report.total-based message earlier (before trying getLinkedTransaction). However, this would be a workaround that masks the real problem — the optimistic data should accurately represent the post-removal state so the UI renders correctly without needing extra fallback logic.


    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.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 3, 2026
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 3, 2026
  5. melvin-bot commented on Apr 3, 2026

    @melvin-bot

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

  6. changed the title [-]Broken report page and report review after removing split[/-] [+][$250] Broken report page and report review after removing split[/+] on Apr 3, 2026
  7. melvin-bot commented on Apr 3, 2026

    @melvin-bot
  8. ReaperOAK commented on Apr 3, 2026

    @ReaperOAK
    Contributor

    Proposal

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

    After removing a split expense via "Edit splits" → "Remove split", the report page shows only the amount with no expense details, and the report preview in the chat is empty/broken.

    What is the root cause of that problem?

    The root cause is in src/libs/actions/IOU/Split.ts in the updateSplitTransactionsFromSplitExpensesFlow function. When a split is removed (non-reverse UPDATE path, ~line 1858-1905), the firstIOU report action is optimistically deleted — its message.html is set to '' and IOUTransactionID is set to null. However, the REPORT_PREVIEW action's message text is never updated to reflect the new report total.

    Here's why:

    1. getCleanUpTransactionThreadReportOnyxData is called with shouldAddUpdatedReportPreviewActionToOnyxData: false (line 1826), so it only returns updated metadata fields (childVisibleActionCount, childCommenterCount, etc.) without pushing them to Onyx.
    2. pushUpdatedReportPreviewActionToOnyxData() (line 1905) is only called in the else branch — when firstIOU does NOT exist. When firstIOU exists and is deleted, it's skipped.
    3. The pushUpdatedReportPreviewActionToOnyxData function itself (line 1219-1246) only pushes metadata fields from updateOptimisticParentReportAction — it never updates the message text of the REPORT_PREVIEW action.

    The result: when getReportPreviewMessage (src/libs/ReportUtils.ts:5380) runs, it calls getLinkedTransaction(iouReportAction) to build the preview text. Since the deleted IOU action has IOUTransactionID: null, getLinkedTransaction returns empty. The function falls back to reportActionMessage, which is also empty because the action's message HTML was cleared. This produces the blank preview.

    Compare this with deleteMoneyRequest in src/libs/actions/IOU/index.ts (lines 8134-8157), which correctly recomputes the REPORT_PREVIEW message text:

    const messageText = Localize.translateLocal(
        hasNonReimbursableTransactions ? 'iou.payerSpentAmount' : 'iou.payerOwesAmount',
        convertToDisplayString(updatedIOUReport?.total, updatedIOUReport?.currency),
        getPersonalDetailsForAccountID(updatedIOUReport?.managerID ?? CONST.DEFAULT_NUMBER_ID).login ?? '',
    );
    // Then updates updatedReportPreviewAction.message with the new text

    And also decrements childMoneyRequestCount. The split removal path does neither of these.

    Note: MelvinBot's claim that the REVERT path "does not mark the REPORT_PREVIEW for deletion" is incorrect — it does so via expenseReport.parentReportActionID at ~line 1965-1980. The actual bug is in the UPDATE path's failure to update the preview message text.

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

    1. Update the REPORT_PREVIEW message text after split removal — In src/libs/actions/IOU/Split.ts, after the firstIOU branch (~line 1900), update the REPORT_PREVIEW action's message field with the recomputed preview text reflecting the new report total. This should mirror what deleteMoneyRequest does in src/libs/actions/IOU/index.ts:8134-8157:
    // After line ~1900 in Split.ts, inside the `if (firstIOU)` block, after pushing the updatedReportAction:
    const reportTotal = reportTotals.get(expenseReportID) ?? 0;
    const hasNonReimbursableTransactions = hasNonReimbursableTransactionsReportUtils(expenseReport?.reportID);
    const messageText = Localize.translateLocal(
        hasNonReimbursableTransactions ? 'iou.payerSpentAmount' : 'iou.payerOwesAmount',
        convertToDisplayString(reportTotal, expenseReport?.currency),
        getPersonalDetailsForAccountID(expenseReport?.managerID ?? CONST.DEFAULT_NUMBER_ID).login ?? '',
    );
    
    if (updatedReportPreviewAction && originalReportPreviewAction) {
        if (Array.isArray(updatedReportPreviewAction?.message)) {
            const message = updatedReportPreviewAction.message.at(0);
            if (message) {
                message.text = messageText;
                message.html = messageText;
            }
        } else if (updatedReportPreviewAction.message) {
            updatedReportPreviewAction.message.text = messageText;
        }
    }
    1. Decrement childMoneyRequestCount on the REPORT_PREVIEW — Also update the report preview's childMoneyRequestCount to reflect the removed expense:
    if (updatedReportPreviewAction && originalReportPreviewAction?.childMoneyRequestCount && originalReportPreviewAction.childMoneyRequestCount > 0) {
        updatedReportPreviewAction.childMoneyRequestCount = originalReportPreviewAction.childMoneyRequestCount - 1;
    }
    1. Push the updated REPORT_PREVIEW to Onyx — After updating the message and count, call pushUpdatedReportPreviewActionToOnyxData() (removing it from the else branch so it's called in both paths).

    What alternative solutions did you explore? (Optional)

    An alternative would be to make getReportPreviewMessage in ReportUtils.ts more resilient — when the linked IOU action has a null IOUTransactionID, fall back to building the message from the report's total rather than returning empty. While this would fix the display issue, it's a band-aid: the optimistic data should accurately represent the post-removal state. The deleteMoneyRequest flow already established the correct pattern of recomputing the preview message text — the split removal flow should follow the same pattern for consistency and correctness. Fixing it at the source also ensures the Onyx data is correct for any other consumers beyond just getReportPreviewMessage.

  9. abbasifaizan70 commented on Apr 3, 2026

    @abbasifaizan70
    Contributor

    Proposal

    What is the root cause of that problem?

    When we remove a split from More > Edit splits, the split edit flow updates the parent report preview action through getCleanUpTransactionThreadReportOnyxData(). In that helper, the preview action is rebuilt with only child-count metadata. That partial object is then written back to the report action collection for the same reportActionID, so the existing preview message payload is lost. Once message is missing, the report row can still show amount totals but cannot render preview text, which is why the preview appears empty.

    reportPreviewAction = {
    reportActionID: originalReportPreviewAction.reportActionID,
    childVisibleActionCount,
    childCommenterCount,
    childLastVisibleActionCreated,
    childOldestFourAccountIDs,
    } as ReportAction;

    onyxData.optimisticData?.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport?.reportID}`,
    value: {
    [updatedReportPreviewAction?.reportActionID ?? CONST.DEFAULT_NUMBER_ID]: updatedReportPreviewAction,
    },

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

    We should preserve the existing preview action fields (especially message) when updating child counters, instead of replacing the whole action object with a reduced shape.

    reportPreviewAction = {
    reportActionID: originalReportPreviewAction.reportActionID,
    childVisibleActionCount,
    childCommenterCount,
    childLastVisibleActionCreated,
    childOldestFourAccountIDs,
    } as ReportAction;

    reportPreviewAction = {
        ...(reportPreviewAction ?? originalReportPreviewAction),
        reportActionID: originalReportPreviewAction.reportActionID,
        childVisibleActionCount,
        childCommenterCount,
        childLastVisibleActionCreated,
        childOldestFourAccountIDs,
    } as ReportAction;
  10. github-actions commented on Apr 3, 2026

    @github-actions
    Contributor

    ⚠️ @abbasifaizan70 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  11. wildan-m commented on Apr 3, 2026

    @wildan-m
    Contributor

    Proposal

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

    After removing a split from a 2-split expense (which triggers a reverse-split operation), the report page only shows the amount without transaction details, and the report preview renders empty.

    What is the root cause of that problem?

    The root cause is in the reverse-split path of updateSplitTransactions in Split.ts. When the number of splits drops from 2 to 1, the code takes the isReverseSplitOperation path. This path has two bugs that break both the report page and the preview:

    1. existingTransaction is forced to undefined:

    requestMoneyInformation.existingTransaction = undefined;

    In the reverse-split path, requestMoneyInformation.existingTransaction is set to undefined. This causes getMoneyRequestInformation to skip the fastMerge path that would normally copy the original transaction's data (merchant, category, receipt, comment, etc.) into the optimistic transaction. Without this merge, the reverted transaction is created with incomplete data, which is why the report page shows only the amount (the transaction exists but lacks detail fields).

    2. currentReportActionID is set to undefined for the reverse-split path:

    currentReportActionID: !isReverseSplitOperation ? currentReportAction?.reportActionID : undefined,

    The ternary !isReverseSplitOperation ? currentReportAction?.reportActionID : undefined passes undefined when isReverseSplitOperation is true. This causes getMoneyRequestInformation to create a brand-new duplicate IOU action in the expense report instead of reusing firstIOU. The original firstIOU remains but is now orphaned from the new transaction flow, leading to the empty preview because the report preview action points to the wrong IOU action chain.

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

    1. Remove the existingTransaction = undefined assignment (line 1335) so the original transaction reference is preserved and getMoneyRequestInformation properly merges the original data into the optimistic transaction.

    2. Pass firstIOU?.reportActionID as currentReportActionID in the reverse-split path (line 1359), changing from:

    currentReportActionID: !isReverseSplitOperation ? currentReportAction?.reportActionID : undefined,
    

    to:

    currentReportActionID: !isReverseSplitOperation ? currentReportAction?.reportActionID : firstIOU?.reportActionID,
    

    This reuses the existing IOU action instead of creating a duplicate, keeping the report action chain consistent for the preview.

    1. Add failure data in the reverse-split path to restore the original transaction and firstIOU action on API failure, ensuring proper rollback.

    Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/87094-fix-broken-report-after-split-removal?expand=1

    What alternative solutions did you explore? (Optional)

    One alternative is to update the returned reportPreviewAction in getCleanUpTransactionThreadReportOnyxData (line 8575) to spread the full original action object. However, since pushUpdatedReportPreviewActionToOnyxData uses Onyx.METHOD.MERGE (not SET), existing fields like message are already preserved in the Onyx store. The preview is empty not because the message field is lost, but because the underlying transaction and IOU action chain is broken by the two bugs described above.

  12. trasnake87 commented on Apr 3, 2026

    @trasnake87
    Contributor

    Proposal

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

    After removing a split from a split expense via "Edit splits", the expense report page displays incorrectly (showing only the total amount without proper expense details) and the report preview card in the chat appears broken/empty.

    What is the root cause of that problem?

    When a split is removed through the delete flow, useDeleteTransactions.ts calls updateSplitTransactions without providing the splitExpensesTotal field in transactionData. This value is critical for correctly computing the new expense report total.

    In updateSplitTransactions (https://github.com/Expensify/App/blob/main/src/libs/actions/IOU/Split.ts#L1096), splitExpensesTotal defaults to 0 when not provided. The report total formula at https://github.com/Expensify/App/blob/main/src/libs/actions/IOU/Split.ts#L1163-L1178 computes changesInReportTotal = sum(remaining splits) - splitExpensesTotal. With splitExpensesTotal = 0, the result is wildly wrong — for example, removing a $40 split from a $100 expense (three splits: $30, $30, $40) yields a report total of -$160 instead of the correct -$60. This corrupted total propagates through getMoneyRequestInformation into the optimistic report data, breaking the expense report display and causing the report preview to render with incorrect state.

    Other callers like SplitExpensePage.tsx (https://github.com/Expensify/App/blob/main/src/pages/iou/SplitExpensePage.tsx#L309) correctly pass splitExpensesTotal, confirming this is a missing parameter in the delete flow.

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

    We should compute splitExpensesTotal from all child transactions (before filtering out the ones being deleted) and pass it in the transactionData parameter. The fix is in useDeleteTransactions.ts:

    // In useDeleteTransactions.ts, before the updateSplitTransactions call (~line 148):
    const allChildTransactionsForTotal = getChildTransactions(allTransactions, allReports, transactionID);
    const splitExpensesTotal = allChildTransactionsForTotal.reduce(
        (total, tx) => total + Math.abs(tx?.amount ?? 0), 0
    );
    
    updateSplitTransactions({
        // ... existing params ...
        transactionData: {
            reportID: report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID),
            originalTransactionID: transactionID,
            splitExpenses: remainingSplitExpenses,
            splitExpensesTotal,  // Add this missing field
        },
        // ... rest of params ...
    });

    This ensures the expense report total is correctly adjusted to reflect only the remaining splits, fixing the broken report display and preview rendering.

  13. 63 remaining items

  14. Krishna2323 commented on May 19, 2026

    @Krishna2323
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: No offending frontend PR — this was caused by a backend change (Expensify/Auth#19931) that modified deleteMoneyRequest() to preserve IOUTransactionID, which broke the split removal flow. Identified by @lakchote here.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/640821

    Regression Test Proposal

    Precondition:

    Test:

    1. Navigate to workspace chat and create report
    2. Add expense
    3. Split expense from step 2
    4. Open one of child expenses
    5. Click More > Edit splits
    6. Select one split
    7. Remove split
    8. Verify report has expense details.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-b538-af84-5f9a-15f5137ce254
  15. melvin-bot commented on May 20, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/2040074536357088393/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. lakchote commented on May 25, 2026

    @lakchote
    Contributor

    Not overdue - this is in the payment and checklist follow-up stage after the fix shipped to production.

  17. mallenexpensify commented on May 26, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @paulnjs paid $250 via Upwork
    Contributor+: @Krishna2323 due $250 via NewDot

    @paulnjs can you please accept the job below? Please reply here and tag me once you have.
    If you're not sent an offer in Upwork when you're assigned to an issue, and an Upwork job exists, please submit a proposal.
    https://www.upwork.com/jobs/~022059080203273242542

    ^ Test case created. Thx

  18. paulnjs commented on May 26, 2026

    @paulnjs
    Contributor

    @mallenexpensify I accepted the job. Thanks!

  19. mallenexpensify commented on May 26, 2026

    @mallenexpensify
    Contributor

    @paulnjs paid, summary updated above. Thx.

  20. laurenreidexpensify commented on Jun 29, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @Krishna2323

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions