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
[hold for 76511] [$250] Endless loading when delete Per diem expense from Self DM chat #75660
📣 @fireball37hbn! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
changed the title [-]Endless loading when delete Per diem expense from Self DM chat[/-][+][$250] Endless loading when delete Per diem expense from Self DM chat[/+]on Nov 21, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-11-28 16:26:45 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Deleting an expense after moving it to the self DM can get stuck in an infinite loading state because a duplicate self DM is created and the user may land in the wrong one.
What is the root cause of that problem?
In changeTransactionsReport (moving to personal), when no self-DM exists we create an optimistic self-DM. We weren’t passing the optimistic self-DM identifiers back to the backend. The backend’s normal pattern is to receive selfDMReportID + selfDMCreatedReportActionID and then send Onyx that clears the temporary self-DM. Without those IDs, the optimistic self-DM lingers as a duplicate, leading to the stuck delete when users are in the wrong chat.
In changeTransactionsReport we look up a self DM; if none is found, we create an optimistic one:
// In changeTransactionsReport, when no self DM exists
const currentTime = DateUtils.getDBTime();
selfDMReport = buildOptimisticSelfDMReport(currentTime);
selfDMCreatedReportAction = buildOptimisticCreatedReportAction(email ?? '', currentTime);
// Track them so we can send to BE
+selfDMParameters = {+ reportID: selfDMReport.reportID,+ createdReportActionID: selfDMCreatedReportAction.reportActionID,+};
Include those IDs in the API call so the backend can clear the optimistic chat:
Activity
melvin-bot commentedon Nov 20, 2025
Triggered auto assignment to @joekaufmanexpensify (
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.melvin-bot commentedon Nov 20, 2025
📣 @fireball37hbn! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
joekaufmanexpensify commentedon Nov 21, 2025
Reproduced
[-]Endless loading when delete Per diem expense from Self DM chat[/-][+][$250] Endless loading when delete Per diem expense from Self DM chat[/+]melvin-bot commentedon Nov 21, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021991988960980010582
melvin-bot commentedon Nov 21, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ahmedGaber93 (
External)marufsharifi commentedon Nov 23, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-11-28 16:26:45 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Deleting an expense after moving it to the self DM can get stuck in an infinite loading state because a duplicate self DM is created and the user may land in the wrong one.
What is the root cause of that problem?
In
changeTransactionsReport(moving to personal), when no self-DM exists we create an optimistic self-DM. We weren’t passing the optimistic self-DM identifiers back to the backend. The backend’s normal pattern is to receiveselfDMReportID+selfDMCreatedReportActionIDand then send Onyx that clears the temporary self-DM. Without those IDs, the optimistic self-DM lingers as a duplicate, leading to the stuck delete when users are in the wrong chat.changeTransactionsReportwe look up a self DM; if none is found, we create an optimistic one:App/src/libs/actions/Transaction.ts
Lines 728 to 757 in 872bd26
App/src/libs/actions/Transaction.ts
Lines 1375 to 1385 in 92c9780
What changes do you think we should make in order to solve the problem?
We just need to pass the optimistic self-DM identifiers to the backend when we create one. The code changes are minimal:
App/src/libs/actions/Transaction.ts
Lines 728 to 757 in 872bd26
const parameters: ChangeTransactionsReportParams = { transactionList: transactionIDs.join(','), reportID, transactionIDToReportActionAndThreadData: JSON.stringify(transactionIDToReportActionAndThreadData), + ...(selfDMParameters.reportID && selfDMParameters.createdReportActionID + ? { + selfDMReportID: selfDMParameters.reportID, + selfDMCreatedReportActionID: selfDMParameters.createdReportActionID, + } + : {}), }; API.write(WRITE_COMMANDS.CHANGE_TRANSACTIONS_REPORT, parameters, { optimisticData, successData, failureData, });If any further FE tweaks or changes are needed during implementation, I’m happy to handle them.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
changeTransactionsReportcompletes.What alternative solutions did you explore? (Optional)
23 remaining items
ahmedGaber93 commentedon Dec 5, 2025
@joekaufmanexpensify I will be OOO for the next 3 weeks. Please reassign this if needed. Thanks!
joekaufmanexpensify commentedon Dec 8, 2025
Will do! I'll reassign this if we end up needing frontend changes here and you're still OOO when it comes time to address those.
joekaufmanexpensify commentedon Dec 15, 2025
Still held
joekaufmanexpensify commentedon Dec 19, 2025
Held
c3024 commentedon Dec 29, 2025
Still on hold!
joekaufmanexpensify commentedon Jan 5, 2026
Still held
joekaufmanexpensify commentedon Jan 12, 2026
Still held
joekaufmanexpensify commentedon Jan 19, 2026
@c3024 I see #76511 was closed without merging. What does that mean for this issue?
c3024 commentedon Jan 20, 2026
This is not reproducible anymore. We can close this.
marufsharifi commentedon Jan 21, 2026
Not reproducible for me too
c3024 commentedon Jan 26, 2026
Not reproducible anymore.