You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-02-04] [$250] Chat - Message copied from empty report shows "Workspace owes 0,00" instead of report title #77158
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.
Open the staging.new.expensify.com website.
Open any workspace chat.
Tap the chat header and select Members.
Invite User B as a member.
Switch to User B's account.
Open the same workspace chat.
Switch back to User A's account.
Create an empty report.
Switch again to User B´s account.
Right-click on the placeholder and tap "Copy message"
Paste the message on the composer
Verify that the copied message is the report title.
Open report and return to workspace chat.
Right-click on the placeholder and tap "Copy message"
Paste the message on the composer.
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)
Same thing happens with a report that has been loaded and accessed previously:
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.
🚨 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
// 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"
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
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:
Locate the React component that renders the report preview text
Extract the currently displayed text from that component
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).
// 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"
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.
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:
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:
First check if the report is unloaded AND handle that case
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 reportsif(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){returnoriginalReportAction.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)
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.
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.
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.
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:
@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]
Activity
melvin-bot commentedon Dec 9, 2025
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.trjExpensify commentedon Dec 9, 2025
Same thing happens with a report that has been loaded and accessed previously:
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.
[-]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[/+]melvin-bot commentedon Dec 9, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021998480202224606955
melvin-bot commentedon Dec 9, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (
External)SAYAN02-DEV commentedon Dec 9, 2025
🚨 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
getReportPreviewfunction 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 loadedisEmptyObject(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
childMoneyRequestCountcan be undefined (not just 0) and the original condition only checked forchildMoneyRequestCount === 0, causing it to failApp/src/libs/ReportUtils.ts
Lines 5147 to 5166 in d6c2eee
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
childReportNamenstead of computing the "owes" message.This check should be added inReportUtils.tsright after the report is loaded and before processing transactions.The condition needs to handle both undefined and 0 values for
childMoneyRequestCountso we have to check both
!originalReportAction?.childMoneyRequestCount || originalReportAction?.childMoneyRequestCount === 0The 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:
This ensures the copied message is always consistent with what the user sees, regardless of the report's state (loaded/unloaded, with/without expenses).
Nodebrute commentedon Dec 9, 2025
🚨 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
that checks
childMoneyRequestCount === 0and 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
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
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
App/src/libs/ReportUtils.ts
Line 5159 in d9ea677
Alternate 2
we can also use
originalReportAction?.childMoneyRequestCount === 0checkApp/src/libs/ReportUtils.ts
Line 5159 in d9ea677
lukeahill97 commentedon Dec 10, 2025
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
getReportPreviewMessagefunction insrc/libs/ReportUtils.ts. The function has two distinct code paths based on whether the report is loaded:Before report is loaded:
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 returnsfalse, 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:Modify the early return section as follows:
This approach:
childMoneyRequestCountandchildReportName) as the existing check, ensuring consistencyWhat alternative solutions did you explore? (Optional)
Checking
report.total === 0later in the function - This would work but spreads the empty report logic across multiple locations in the function, making it harder to maintain.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.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
getReportPreviewMessagewould 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.
47 remaining items
trjExpensify commentedon Jan 20, 2026
PR in progress, removing the payment hold.
[-][$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[/+]melvin-bot commentedon Jan 28, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jan 28, 2026
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:
melvin-bot commentedon Jan 28, 2026
@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]
trjExpensify commentedon Feb 6, 2026
👋 Checklist time here!
thesahindia commentedon Feb 6, 2026
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.
trjExpensify commentedon Feb 9, 2026
Thanks! Payment summary as follows:
Closing. Thanks!
garrettmknight commentedon May 26, 2026
$250 approved for @thesahindia