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-01-30] [$125] Expense - Self DM appears twice in Recents section after deleting two empty reports #78606
But we not update the ONYXKEYS.SELF_DM_REPORT_ID => On the second deletion attempt, selfDMReport was still undefined=> We create another new selfDM report.
What changes do you think we should make in order to solve the problem?
We should change ONYXKEYS.SELF_DM_REPORT_ID when we create the self DM report.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Please re-state the problem that we are trying to solve in this issue.
Expense - Self DM appears twice in Recents section after deleting two empty reports
What is the root cause of that problem?
When deleting multiple empty reports quickly, each deletion would call deleteAppReport, which would check for an existing Self DM using findSelfDMReportID(). When the first deletion created a new Self DM, it was only added to the optimistic data, not to the cached ONYXKEYS.SELF_DM_REPORT_ID. So when the second deletion happened immediately after, findSelfDMReportID() still returned undefined because:
The cache cachedSelfDMReportID was not updated
The first Self DM was in optimistic data, not in allReports yet
This caused two separate Self DM reports to be created.
What changes do you think we should make in order to solve the problem?
We should add an Onyx.merge call to update ONYXKEYS.SELF_DM_REPORT_ID right after creating a new Self DM report in deleteAppReport
if(!selfDMReport){constcurrentTime=DateUtils.getDBTime();selfDMReport=buildOptimisticSelfDMReport(currentTime);selfDMReportID=selfDMReport.reportID;createdAction=buildOptimisticCreatedReportAction(currentUserEmailParam??'',currentTime);selfDMParameters={reportID: selfDMReport.reportID,createdReportActionID: createdAction.reportActionID};// Update the cached Self DM report ID to prevent duplicate Self DM creationOnyx.merge(ONYXKEYS.SELF_DM_REPORT_ID,selfDMReport.reportID);
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
selfDMReportID will be read from selfDMReportID Onyx data and it always has value, but for the new account, selfDMReport is undefined. If it’s undefined, we’ll create the new one and send to BE with reportID and createdReportActionID
After delete the first report, we already create the new selfDMReport, but we didn’t pass the selfDMReportID to buildOptimisticCreatedReportAction so it’ll generate the new report with different reportID from selfDMReportID
What alternative solutions did you explore? (Optional)
N/A
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
We check whether it exists by getting the report based on the ID from findSelfDMReportID, which returns the ID from selfDMReportID onyx key. However, every user already has a self dm report on the BE. So, when we delete the empty report twice, we create 2 optimistic reports because each optimistic report has a different reportID.
What changes do you think we should make in order to solve the problem?
First, we need to pass the self DM report ID from findSelfDMReportID when creating the optimistic report so the optimistic report is created with the same reportID we have on the BE.
Next, we need to remove the optimistic created action, otherwise we will have 2 created actions on the report. We will also remove the selfDMParameters as it's unused now. The end result will look like this:
NOTE: we can optionally only create the self DM report if the report that we delete contains transaction because when it's an empty report, the DeleteAppReport API doesn't return the self DM report data as the response.
changed the title [-]Expense - Self DM appears twice in Recents section after deleting two empty reports[/-][+][$250] Expense - Self DM appears twice in Recents section after deleting two empty reports[/+]on Jan 2, 2026
changed the title [-][$125] Expense - Self DM appears twice in Recents section after deleting two empty reports[/-][+][Due for payment 2026-01-30] [$125] Expense - Self DM appears twice in Recents section after deleting two empty reports[/+]on Jan 23, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.7-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@rojiphil@garrettmknight 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 30, 2025
Triggered auto assignment to @garrettmknight (
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.daledah commentedon Dec 30, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Self DM appears twice in Recents section after deleting two empty reports.
What is the root cause of that problem?
We have the cache for the self DM report ID here
App/src/libs/ReportUtils.ts
Lines 1208 to 1212 in ae4cd7c
App/src/libs/ReportUtils.ts
Lines 1876 to 1879 in ae4cd7c
The first time we delete a report, we create the selfDM report onyx data here
App/src/libs/actions/Report.ts
Lines 4965 to 4973 in ae4cd7c
But we not update the
ONYXKEYS.SELF_DM_REPORT_ID=> On the second deletion attempt,selfDMReportwas stillundefined=> We create another new selfDM report.What changes do you think we should make in order to solve the problem?
We should change
ONYXKEYS.SELF_DM_REPORT_IDwhen we create the self DM report.App/src/libs/actions/Report.ts
Line 4976 in ae4cd7c
Alternatively, we could add a flag to avoid using the cache in this case.
App/src/libs/ReportUtils.ts
Lines 1876 to 1879 in ae4cd7c
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
samranahm commentedon Dec 30, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - Self DM appears twice in Recents section after deleting two empty reports
What is the root cause of that problem?
When deleting multiple empty reports quickly, each deletion would call
deleteAppReport, which would check for an existing Self DM usingfindSelfDMReportID(). When the first deletion created a new Self DM, it was only added to the optimistic data, not to the cachedONYXKEYS.SELF_DM_REPORT_ID. So when the second deletion happened immediately after,findSelfDMReportID()still returned undefined because:cachedSelfDMReportIDwas not updatedThis caused two separate Self DM reports to be created.
What changes do you think we should make in order to solve the problem?
We should add an
Onyx.mergecall to updateONYXKEYS.SELF_DM_REPORT_IDright after creating a new Self DM report indeleteAppReporthere
App/src/libs/actions/Report.ts
Lines 4971 to 4976 in 8d19e95
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
paulnjs commentedon Dec 31, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - Self DM appears twice in Recents section after deleting two empty reports
What is the root cause of that problem?
When users delete the report, we’ll find the selfDMReportID and selfDMReport
App/src/libs/actions/Report.ts
Lines 4965 to 4966 in ae4cd7c
selfDMReportID will be read from selfDMReportID Onyx data and it always has value, but for the new account, selfDMReport is undefined. If it’s undefined, we’ll create the new one and send to BE with reportID and createdReportActionID
After delete the first report, we already create the new selfDMReport, but we didn’t pass the selfDMReportID to buildOptimisticCreatedReportAction so it’ll generate the new report with different reportID from selfDMReportID
App/src/libs/actions/Report.ts
Line 4972 in ae4cd7c
That why selfDMReport is still undefined after deleting the first one.
We shouldn’t generate the new selfDMReportID because BE will throw the error when we try to send the message on that report
What changes do you think we should make in order to solve the problem?
Update this line
App/src/libs/actions/Report.ts
Line 4972 in ae4cd7c
To
What alternative solutions did you explore? (Optional)
N/A
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
bernhardoj commentedon Dec 31, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Dupe self dm report shows in start chat page after deleting 2 empty reports.
What is the root cause of that problem?
When we delete a report, we will create an optimistic self dm report if it doesn't exist yet on the FE.
App/src/libs/actions/Report.ts
Lines 4965 to 4986 in 1d1ea3d
We check whether it exists by getting the report based on the ID from
findSelfDMReportID, which returns the ID fromselfDMReportIDonyx key. However, every user already has a self dm report on the BE. So, when we delete the empty report twice, we create 2 optimistic reports because each optimistic report has a differentreportID.What changes do you think we should make in order to solve the problem?
First, we need to pass the self DM report ID from
findSelfDMReportIDwhen creating the optimistic report so the optimistic report is created with the samereportIDwe have on the BE.Next, we need to remove the optimistic created action, otherwise we will have 2 created actions on the report. We will also remove the
selfDMParametersas it's unused now. The end result will look like this:NOTE: we can optionally only create the self DM report if the report that we delete contains transaction because when it's an empty report, the DeleteAppReport API doesn't return the self DM report data as the response.
melvin-bot commentedon Jan 2, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022007151481601471722
[-]Expense - Self DM appears twice in Recents section after deleting two empty reports[/-][+][$250] Expense - Self DM appears twice in Recents section after deleting two empty reports[/+]52 remaining items
[-][$125] Expense - Self DM appears twice in Recents section after deleting two empty reports[/-][+][Due for payment 2026-01-30] [$125] Expense - Self DM appears twice in Recents section after deleting two empty reports[/+]melvin-bot commentedon Jan 23, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jan 23, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.7-3 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-30. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jan 23, 2026
@rojiphil @garrettmknight 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]
garrettmknight commentedon Jan 31, 2026
Payment Summary