Skip to content

[Due for payment 2026-02-04] [$250] Chat - Message copied from empty report shows "Workspace owes 0,00" instead of report title #77158

Closed

Description

@nlemma

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.2.74-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: #75934
Email or phone of affected tester (no customers): ibellicotest+2180@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Motorola MotoG60 / Android 12 / Chrome ( mWeb / Hybrid app) - Windows 11 / Chrome
App Component: Chat Report View

Action Performed:

Prerequisite: Have two accounts opened on two different devices or environments.
Prerequisite 2: User A has at least one workspace.

  1. Open the staging.new.expensify.com website.
  2. Open any workspace chat.
  3. Tap the chat header and select Members.
  4. Invite User B as a member.
  5. Switch to User B's account.
  6. Open the same workspace chat.
  7. Switch back to User A's account.
  8. Create an empty report.
  9. Switch again to User B´s account.
  10. Right-click on the placeholder and tap "Copy message"
  11. Paste the message on the composer
  12. Verify that the copied message is the report title.
  13. Open report and return to workspace chat.
  14. Right-click on the placeholder and tap "Copy message"
  15. Paste the message on the composer.
  16. Note that now the copied message shows "Workspace owes $0,00" instead of report´s title.

Expected Result:

Message copied from empty report´s preview after opening it, should still show report´s title when pasting it on composer.

Actual Result:

Message copied from empty report´s preview after opening it, shows "Workspace owes $0,00" instead of report´s title, after pasting it on composer. (Step 73 of PR is failing)

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

Bug7024940_1765288168239.Empty_Details.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021998480202224606955
  • Upwork Job ID: 1998480202224606955
  • Last Price Increase: 2025-12-16
  • Automatic offers:
    • truph01 | Contributor | 109869754
Issue OwnerCurrent Issue Owner: @trjExpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @trjExpensify (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. trjExpensify commented on Dec 9, 2025

    @trjExpensify
    Contributor

    Same thing happens with a report that has been loaded and accessed previously:

    Image

    I think the right course of action here is to simply copy the report name as displayed in the preview whenever someone clicks "Copy message" on a report preview.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Dec 9, 2025
  5. changed the title [-]Chat - Message copied from empty report shows "Workspace owes 0,00" instead of report title[/-] [+][$250] Chat - Message copied from empty report shows "Workspace owes 0,00" instead of report title[/+] on Dec 9, 2025
  6. melvin-bot commented on Dec 9, 2025

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

    @melvin-bot

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

  9. SAYAN02-DEV commented on Dec 9, 2025

    @SAYAN02-DEV

    🚨 Edited by proposal-police: This proposal was edited at 2025-12-09 21:38:00 UTC.

    Proposal

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

    Message copied from empty report´s preview after opening it, shows "Workspace owes $0,00" instead of report´s title, after pasting it on composer.

    What is the root cause of that problem?

    The getReportPreview function doesn't check if the loaded report is empty (childMoneyRequestCount === 0) and should display the report title. It only checks this condition when the report is NOT loaded isEmptyObject(report).
    Once the report is loaded, even if it's empty, it proceeds to calculate and return "Workspace owes $0.00".

    Also another issue is that childMoneyRequestCount can be undefined (not just 0) and the original condition only checked for childMoneyRequestCount === 0, causing it to fail

    App/src/libs/ReportUtils.ts

    Lines 5147 to 5166 in d6c2eee

    function getReportPreviewMessage(
    reportOrID: OnyxInputOrEntry<Report> | string,
    iouReportAction: OnyxInputOrEntry<ReportAction> = null,
    shouldConsiderScanningReceiptOrPendingRoute = false,
    isPreviewMessageForParentChatReport = false,
    policy?: OnyxInputOrEntry<Policy>,
    isForListPreview = false,
    originalReportAction: OnyxInputOrEntry<ReportAction> = iouReportAction,
    ): string {
    const report = typeof reportOrID === 'string' ? getReport(reportOrID, allReports) : reportOrID;
    const reportActionMessage = getReportActionHtml(iouReportAction);
    if (isEmptyObject(report) || !report?.reportID) {
    // This iouReport may be unavailable for one of the following reasons:
    // 1. After SignIn, the OpenApp API won't return iouReports if they're settled.
    // 2. The iouReport exists in local storage but hasn't been loaded into the allReports. It will be loaded automatically when the user opens the iouReport.
    // Until we know how to solve this the best, we just display the report action message.
    // If the report is empty, we display the report name to avoid showing "payer owes 0"
    return !!originalReportAction?.childReportName && originalReportAction?.childMoneyRequestCount === 0 ? originalReportAction?.childReportName : reportActionMessage;
    }

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

    Add a check after the report is loaded to see if it's an empty report (no transactions), and if so, return the childReportName nstead of computing the "owes" message.This check should be added in ReportUtils.ts right after the report is loaded and before processing transactions.

    The condition needs to handle both undefined and 0 values for childMoneyRequestCount
    so we have to check both !originalReportAction?.childMoneyRequestCount || originalReportAction?.childMoneyRequestCount === 0

    if (!!originalReportAction?.childReportName && (!originalReportAction?.childMoneyRequestCount || originalReportAction?.childMoneyRequestCount === 0)) {
        return originalReportAction.childReportName;
    }
    

    The fix adds a second check after confirming the report exists in memory.

    After fix:
    https://github.com/user-attachments/assets/6c6068af-8ae3-4f1e-8f6a-d5203cc3dc4a

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore?

    Instead of recalculating the message in the getReportPreviewMessage() function when the "Copy message" action is triggered, we could implement a more direct approach:

    Copy the text directly from the UI preview component that displays the report preview.

    When the user right-clicks and selects "Copy message" on a report preview:

    1. Locate the React component that renders the report preview text
    2. Extract the currently displayed text from that component
    3. Copy that exact text to clipboard

    This ensures the copied message is always consistent with what the user sees, regardless of the report's state (loaded/unloaded, with/without expenses).

  10. Nodebrute commented on Dec 9, 2025

    @Nodebrute
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-12-09 22:09:49 UTC.

    Proposal

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

    Message copied from empty report shows "Workspace owes 0,00" instead of report title

    What is the root cause of that problem?

    Before the report is opened, it isn't loaded in allReports, so the function hits an early return at

    App/src/libs/ReportUtils.ts

    Lines 5159 to 5165 in d9ea677

    if (isEmptyObject(report) || !report?.reportID) {
    // This iouReport may be unavailable for one of the following reasons:
    // 1. After SignIn, the OpenApp API won't return iouReports if they're settled.
    // 2. The iouReport exists in local storage but hasn't been loaded into the allReports. It will be loaded automatically when the user opens the iouReport.
    // Until we know how to solve this the best, we just display the report action message.
    // If the report is empty, we display the report name to avoid showing "payer owes 0"
    return !!originalReportAction?.childReportName && originalReportAction?.childMoneyRequestCount === 0 ? originalReportAction?.childReportName : reportActionMessage;

    that checks childMoneyRequestCount === 0 and correctly returns the report name via childReportName.

    After the report is opened, it's loaded into allReports, the early return is skipped because the report exists, and the function continues through the logic, eventually returning "Workspace owes $0,00" for empty reports.

    App/src/libs/ReportUtils.ts

    Lines 5358 to 5361 in d9ea677

    return translateLocal('iou.payerSpentAmount', {
    payer: getDisplayNameForParticipant({accountID: report.ownerAccountID, formatPhoneNumber: formatPhoneNumberPhoneUtils}) ?? '',
    amount: formattedAmount,
    });

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

    Check if report is empty with no transactions and total is 0 and return report name to avoid showing "owes $0". We can do something like this here

      if (allReportTransactions.length === 0 && totalAmount === 0) {
            // Return report name for empty reports to avoid showing "owes $0"
                    const reportName = ReportNameUtils.getReportName(report, reportAttributesDerivedValue);
            return reportName || originalReportAction?.childReportName || reportActionMessage;
        }
    
    Screen.Recording.2025-12-10.at.2.36.00.AM.mov

    What alternative solutions did you explore? (Optional)

    Alternatively we can add the above check here

    if (isEmptyObject(report) || !report?.reportID) {

    Alternate 2
    we can also use originalReportAction?.childMoneyRequestCount === 0 check

    if (isEmptyObject(report) || !report?.reportID) {

  11. lukeahill97 commented on Dec 10, 2025

    @lukeahill97

    Proposal

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

    When a user copies a message from an empty report's preview (using "Copy message" from the context menu), after the report has been opened/loaded, the copied text shows "Workspace owes $0,00" instead of the report's title. Before opening the report, copying the message correctly shows the report title.

    What is the root cause of that problem?

    The root cause is in the getReportPreviewMessage function in src/libs/ReportUtils.ts. The function has two distinct code paths based on whether the report is loaded:

    Before report is loaded:

    if (isEmptyObject(report) || !report?.reportID) {
        // Returns childReportName for empty reports (childMoneyRequestCount === 0)
        return !!originalReportAction?.childReportName && originalReportAction?.childMoneyRequestCount === 0 
            ? originalReportAction?.childReportName 
            : reportActionMessage;
    }

    After report is loaded:
    The function skips this early return and proceeds through the full calculation logic, eventually returning "Workspace owes $0.00" for empty reports.

    The fundamental issue is that the empty report check is INSIDE the "report not loaded" condition. Once the report is loaded into memory (after opening it), the isEmptyObject(report) check returns false, causing the function to skip the empty report handling entirely and proceed to calculate the "owes" message.

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

    Move the empty report check OUTSIDE of the "report not loaded" condition so it applies regardless of whether the report is loaded or not.

    Instead of nesting the empty report logic inside the isEmptyObject(report) check, we should:

    1. First check if the report is unloaded AND handle that case
    2. Then separately check if the report (loaded or not) is empty, and return the report name

    Modify the early return section as follows:

    // Handle unloaded reports
    if (isEmptyObject(report) || !report?.reportID) {
        return !!originalReportAction?.childReportName && originalReportAction?.childMoneyRequestCount === 0 
            ? originalReportAction?.childReportName 
            : reportActionMessage;
    }
    
    // Handle empty reports (whether loaded or not) - return report name instead of "owes $0"
    if (originalReportAction?.childMoneyRequestCount === 0 && originalReportAction?.childReportName) {
        return originalReportAction.childReportName;
    }

    This approach:

    • Keeps all empty report handling logic at the TOP of the function
    • Uses the same data source (childMoneyRequestCount and childReportName) as the existing check, ensuring consistency
    • Is a minimal change that follows the existing pattern in the codebase
    • Avoids adding conditional checks deeper in the function where the "owes" message is calculated

    What alternative solutions did you explore? (Optional)

    1. Checking report.total === 0 later in the function - This would work but spreads the empty report logic across multiple locations in the function, making it harder to maintain.

    2. Checking allReportTransactions.length === 0 - Similar issue; this adds the check in a different location and uses a different data source than the existing empty report check.

    3. Fixing at the copy action level - We could modify the context menu's "Copy message" action to use the displayed text directly instead of recalculating. However, this doesn't address the root cause and other parts of the app that call getReportPreviewMessage would still have this issue.

    The proposed solution is cleaner because it keeps all empty report handling consolidated at the top of the function, using the same data sources as the existing logic.

  12. 47 remaining items

  13. trjExpensify commented on Jan 20, 2026

    @trjExpensify
    Contributor

    PR in progress, removing the payment hold.

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jan 28, 2026
  15. changed the title [-][$250] Chat - Message copied from empty report shows "Workspace owes 0,00" instead of report title[/-] [+][Due for payment 2026-02-04] [$250] Chat - Message copied from empty report shows "Workspace owes 0,00" instead of report title[/+] on Jan 28, 2026
  16. melvin-bot commented on Jan 28, 2026

    @melvin-bot

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

  17. melvin-bot commented on Jan 28, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.10-6 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-02-04. 🎊

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

  18. melvin-bot commented on Jan 28, 2026

    @melvin-bot

    @thesahindia / @truph01 @trjExpensify 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]

  19. trjExpensify commented on Feb 6, 2026

    @trjExpensify
    Contributor

    👋 Checklist time here!

  20. thesahindia commented on Feb 6, 2026

    @thesahindia
    Member

    Simple improvement. Only need test case. Steps are below:

    Prerequisite 1: Have two accounts opened on two different devices or environments.
    Prerequisite 2: User A has a workspace.

    1. Login to User A account
    2. Go to the workspace chat
    3. Click "+" > Create report
    4. Hover over the empty report > Click on the 3 dots > Copy message
    5. Paste the message on the composer
    6. Verify that the copied message is the report title
    7. Click "Add expense" > Create expense > Fill details and submit
    8. Hover over the expense report message > Click on the 3 dots > Copy message
    9. Paste the message on the composer
    10. Verify that the copied message is the report title
    11. Tag user B in the workspace chat > "Invite to chat only"
    12. Submit an expense
    13. Switch to user B account
    14. Hover over the expense message > Click on the 3 dots > Copy message
    15. Verify that the copied message is the report title
  21. trjExpensify commented on Feb 9, 2026

    @trjExpensify
    Contributor

    Thanks! Payment summary as follows:

    • $250 to @thesahindia for C+ (Go ahead and request!)
    • $250 to @truph01 for the PR (paid you via Upwork!)

    Closing. Thanks!

  22. garrettmknight commented on May 26, 2026

    @garrettmknight
    Contributor

    $250 approved for @thesahindia

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.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions