Skip to content

[Due for payment 2026-01-20] [$250] Expense report - Rejected expense is displayed duplicated in the report #76982

Closed

Description

@jponikarchuk

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.2.73-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #71438
Email or phone of affected tester (no customers): ndk.2303+130@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 11 Home/Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Create new workspace
  1. Open https://staging.new.expensify.com/
  2. Navigate to Workspace chat
  3. Create 2 expenses in a report
  4. Create new empty report
  5. Submit the report in Step 3
  6. Navigate to 1 of 2 expenses created in Step 3
  7. Reject the expense
  8. Navigate to report contain the rejected expense

Expected Result:

The report should display the single expense detail view

Actual Result:

Rejected expense is displayed twice in Report. The expenses are displayed as report preview instead of list

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021998091313374387693
  • Upwork Job ID: 1998091313374387693
  • Last Price Increase: 2025-12-08
Issue OwnerCurrent Issue Owner: @robertjchen

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 8, 2025
  2. melvin-bot commented on Dec 8, 2025

    @melvin-bot

    Triggered auto assignment to @sakluger (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.

  3. abbasifaizan70 commented on Dec 8, 2025

    @abbasifaizan70
    Contributor

    Proposal

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

    When a rejected expense is moved to a new report, navigating to that report displays the expense twice as report preview instead of showing a single expense detail view.

    What is the root cause of that problem?

    When an expense is rejected from a report with multiple expenses, a report preview action is created in the workspace chat (policyExpenseChat). However, this report preview action is incorrectly being included in the expense report's own report actions when it should only exist in the workspace chat.

    The getCombinedReportActions function filters out CREATE and TRACK actions from money request reports, but it does not filter out REPORT_PREVIEW actions. Report preview actions should only be displayed in workspace chats (parentReportID), not in expense reports themselves. When a rejected expense report contains a report preview action, it causes the expense to be displayed twice - once as the actual transaction and once as the report preview action.

    The Problem Flow:

    1. Expense is rejected → moved to new report
    2. Report preview action created in workspace chat (correct)
    3. Report preview action also appears in expense report actions (incorrect)
    4. When viewing expense report → shows transaction + report preview action
    5. Result: Expense displayed twice as preview instead of single detail view ❌
    

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

    Filter out report preview actions from expense report actions in the getCombinedReportActions function. Report preview actions should only exist in workspace chats, not in expense reports (EXPENSE, IOU, or INVOICE type reports).

    File: App/src/libs/ReportActionsUtils.ts

    Update the getCombinedReportActions function to filter out report preview actions from money request reports:

    const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
    const isSelfDM = report?.chatType === CONST.REPORT.CHAT_TYPE.SELF_DM;
    const isMoneyRequest = report?.type === CONST.REPORT.TYPE.EXPENSE || report?.type === CONST.REPORT.TYPE.IOU || report?.type === CONST.REPORT.TYPE.INVOICE;
    // Filter out request and send money request actions because we don't want to show any preview actions for one transaction reports
    // Also filter out report preview actions from money request reports (expense, IOU, invoice) as they should only exist in workspace chats
    const filteredReportActions = [...filteredParentReportActions, ...filteredTransactionThreadReportActions].filter((action) => {
        // Filter out report preview actions from money request reports
        if (isMoneyRequest && isReportPreviewAction(action)) {
            return false;
        }
        if (!isMoneyRequestAction(action)) {
            return true;
        }
        const actionType = getOriginalMessage(action)?.type ?? '';
        if (isSelfDM) {
            return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE;
        }
        return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE && actionType !== CONST.IOU.REPORT_ACTION_TYPE.TRACK;
    });

    Why this works:

    1. Prevents duplicate display: Filters out report preview actions from expense reports, ensuring they only appear in workspace chats
    2. Maintains correct view: Allows isSingleTransactionReport to correctly identify single-transaction reports, which enables the proper detail view
    3. Targeted fix: Only affects money request reports (EXPENSE, IOU, INVOICE), leaving workspace chats unaffected
    4. Consistent with existing logic: Follows the same pattern as filtering CREATE and TRACK actions

    What alternative solutions did you explore? (Optional)

    None

  4. dmkt9 commented on Dec 8, 2025

    @dmkt9
    Contributor

    Proposal

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

    Rejected expense is displayed twice in Report. The expenses are displayed as report preview instead of list

    What is the root cause of that problem?

    1. When there is an open report, the rejected expense will be moved into this report.

      App/src/libs/actions/IOU.ts

      Lines 13531 to 13561 in 3c1691d

      if (existingOpenReport) {
      movedToReport = existingOpenReport;
      rejectedToReportID = existingOpenReport.reportID;
      const [, , iouAction, ,] = buildOptimisticMoneyRequestEntities({
      iouReport: movedToReport,
      type: CONST.IOU.REPORT_ACTION_TYPE.CREATE,
      amount: transactionAmount,
      currency: getCurrency(transaction),
      comment,
      payeeEmail: getLoginByAccountID(report.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID) ?? '',
      participants: [{accountID: report?.ownerAccountID}],
      transactionID: transaction.transactionID,
      existingTransactionThreadReportID: childReportID,
      shouldGenerateTransactionThreadReport: false,
      });
      optimisticData.push(
      {
      onyxMethod: Onyx.METHOD.MERGE,
      key: `${ONYXKEYS.COLLECTION.REPORT}${movedToReport?.reportID}`,
      value: {
      ...movedToReport,
      total: (movedToReport?.total ?? 0) - transactionAmount,
      },
      },
      {
      onyxMethod: Onyx.METHOD.MERGE,
      key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${rejectedToReportID}`,
      value: {[iouAction.reportActionID]: iouAction},
      },

    2. At this, we create an optimistic iouAction.

      const [, , iouAction, ,] = buildOptimisticMoneyRequestEntities({

      However, we do not set the createdIOUReportActionID parameter to the reportActionID of the iouAction. As a result, the reportActionID of the iouAction is not sent to the backend, and the backend defaults to creating a new iouAction with a different reportActionID. This leads to two valid iouActions existing in the report, which causes the current issue.

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

    We need to set createdIOUReportActionID.

        createdIOUReportActionID = iouAction.reportActionID;
    

    What alternative solutions did you explore? (Optional)

    N/A

  5. changed the title [-]Expense report - Rejected expense is displayed duplicatedly in the report[/-] [+]Expense report - Rejected expense is displayed duplicated in the report[/+] on Dec 8, 2025
  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Dec 8, 2025
  7. changed the title [-]Expense report - Rejected expense is displayed duplicated in the report[/-] [+][$250] Expense report - Rejected expense is displayed duplicated in the report[/+] on Dec 8, 2025
  8. melvin-bot commented on Dec 8, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 8, 2025
  10. melvin-bot commented on Dec 8, 2025

    @melvin-bot

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

  11. moved this to Bugs and Follow Up Issues in #expensify-bugson Dec 8, 2025
  12. 31 remaining items

  13. melvin-bot commented on Jan 13, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. melvin-bot commented on Jan 13, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.99-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-01-20. 🎊

    For reference, here are some details about the assignees on this issue:

    • @hoangzinh requires payment through NewDot Manual Requests
    • @dmkt9 requires payment (Needs manual offer from BZ)
  15. melvin-bot commented on Jan 13, 2026

    @melvin-bot

    @hoangzinh The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  16. sakluger commented on Jan 20, 2026

    @sakluger
    Contributor

    Hey @dmkt9, please let me know once you've accepted the Upwork offer: https://www.upwork.com/nx/wm/offer/110163501

    @hoangzinh please complete the BZ checklist by payment date tomorrow.

  17. dmkt9 commented on Jan 20, 2026

    @dmkt9
    Contributor

    Hey @dmkt9, please let me know once you've accepted the Upwork offer: https://www.upwork.com/nx/wm/offer/110163501

    @sakluger Thank you. Payment requested.

  18. hoangzinh commented on Jan 20, 2026

    @hoangzinh
    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: https://github.com/Expensify/App/pull/70960/files#r2708063196

    • [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:

    Regression Test Proposal

    Test:

    1. Sign in to ND
    2. Navigate to Workspace chat
    3. Create 2 expenses in a report
    4. Create a new empty report
    5. Submit the report in Step 3
    6. Navigate to 1 of 2 expenses created in Step 3
    7. Reject the expense
    8. Navigate to report contain the rejected expense
    9. Verify that the report should display the single expense detail view of the rejected expense in step 7

    Do we agree 👍 or 👎

  19. melvin-bot commented on Jan 20, 2026

    @melvin-bot

    Issue is ready for payment but no BZ is assigned. @johncschuster you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

  20. sakluger commented on Jan 21, 2026

    @sakluger
    Contributor

    Payment Summary

    Contributor: @dmkt9 paid $250 via Upwork
    Contributor+: @hoangzinh due $250 via Newdot

  21. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Jan 21, 2026
  22. garrettmknight commented on Jan 28, 2026

    @garrettmknight
    Contributor

    $250 approved for @hoangzinh

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