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-03-17] [$250] Expense details - Two expenses appears in report for user invuted to chat only #83442
Version Number: v9.3.25-13 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Retest KI #75754 Email or phone of affected tester (no customers): - Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: MacOS Monterey 12.7.4 / Chrome App Component: Money Requests
Action Performed:
As user A create a workspace
Go to workspace chat
Click on header > Members > Invite a new user > Invite User B
Return to workspace chat > Click invite to chat only
Login to new dot as User B > Open the workspace chat
changed the title [-]Expense details - Two expenses appears in report for user invuted to chat only[/-][+][$250] Expense details - Two expenses appears in report for user invuted to chat only[/+]on Feb 25, 2026
Please re-state the problem that we are trying to solve in this issue.
When User B is invited to a workspace chat as "chat only" (via the ACTIONABLE_MENTION_WHISPER resolution 'invited'), and User A (the admin) submits a new expense, User B sees two duplicate expenses when opening the expense from the workspace chat. The expected behavior is that only one expense should be displayed.
What is the root cause of that problem?
The most likely root cause is a race condition in ReportScreen.tsx involving the includeOrphanedTransactions=true flag and the legacy transaction thread creation logic.
Here's the sequence that causes duplicates:
The "invite to chat only" flow sends ResolveActionableMentionWhisper with resolution='invited' to the backend (src/libs/actions/Report/index.ts:4703). All member setup happens server-side — there is no "chat only" role in the frontend. The backend likely provides this user with limited report action data compared to a full workspace member.
When the chat-only member opens the expense report (via REPORT_PREVIEW → MoneyRequestReportPreview.openReportFromPreview() at src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx:101-117), ReportScreen loads.
ReportScreen collects transactions via useReportTransactionsCollection (derived from COLLECTION.TRANSACTION keyed by transaction.reportID) — this is independent of report actions.
getAllNonDeletedTransactions is called with includeOrphanedTransactions=true at src/pages/inbox/ReportScreen.tsx:342. This means transactions are included even when no matching IOU action exists in the loaded report actions (src/libs/MoneyRequestReportUtils.ts:86-104).
The legacy transaction thread creation effect at src/pages/inbox/ReportScreen.tsx:937-968 fires because getIOUActionForReportID() returns undefined (the IOU action hasn't loaded yet for this limited-access user). This creates a new optimistic IOU action + transaction thread.
When the original IOU action arrives from the server, the report now has two IOU actions pointing to the same transaction — the optimistic one from step 5 and the real one from the server.
This results in the expense appearing twice in the expense report view.
A contributing factor is the dual-display architecture: MoneyRequestReportActionsList renders transactions in a table header (MoneyRequestReportTransactionList) and report actions in a FlatList below. The deduplication filter (IOU_ACTIONS_TO_FILTER_OUT at src/libs/MoneyRequestReportUtils.ts:34) only filters CREATE and TRACK types. If the optimistic IOU action has a different type, it could bypass the filter and appear alongside the transaction table entry.
What changes do you think we should make in order to solve the problem?
The fix should address the root cause — the legacy thread creation firing prematurely for chat-only members who have transaction data but delayed/missing IOU actions:
In ReportScreen.tsx (lines 937-968): Add a guard to the legacy transaction thread creation effect that checks whether report actions have finished loading (e.g., check isLoadingInitialReportActions or verify the report actions collection is not empty) before deciding that an IOU action is missing. This prevents the race condition where the effect creates a duplicate optimistic IOU action before the real one arrives.
Alternatively, in getAllNonDeletedTransactions at src/libs/MoneyRequestReportUtils.ts:86-104, consider not including orphaned transactions while report actions are still loading — only fall back to includeOrphanedTransactions behavior when report actions have definitively loaded and the IOU action is confirmed missing.
What alternative solutions did you explore? (Optional)
Deduplication by transactionID: Adding a post-filter that ensures each IOUTransactionID appears at most once across both the transaction table and report actions list. This would be a safety net but doesn't fix the underlying race condition.
Server-side fix: Ensuring the backend returns complete IOU actions for chat-only members when they open an expense report. This would prevent the orphaned-transaction scenario entirely, but the client-side race condition should still be guarded against.
Detailed Investigation
Root Cause Analysis
The investigation traced the data flow across three dimensions:
"Invite to chat only" sends resolution='invited' via WRITE_COMMANDS.RESOLVE_ACTIONABLE_MENTION_WHISPER
The backend handles all member creation — no optimistic data for the membership is created client-side
There is no "chat only" role in the frontend (CONST.POLICY.ROLE only has ADMIN, AUDITOR, USER); it's a billing-level concept (confirmed by chatOnlyActorList in src/types/onyx/PurchaseList.ts)
isActionVisibleOnMoneyRequestReport (src/libs/MoneyRequestReportUtils.ts:34-53) filters CREATE and TRACK IOU types from the FlatList to prevent duplication with the table
Transaction data comes from DERIVED.REPORT_TRANSACTIONS_AND_VIOLATIONS (keyed by transaction.reportID), independent of report actions
3. View selection and race conditions (src/pages/inbox/ReportScreen.tsx):
shouldDisplayReportTableView (src/libs/MoneyRequestReportUtils.ts:113-129) decides between single-transaction view and table view
includeOrphanedTransactions=true (line 342) includes transactions without matching IOU actions
This analysis is based on code tracing without production log confirmation. The exact data the backend sends to chat-only members is unknown (server-side code is not available). Production logs would confirm whether duplicate IOU actions are being created and which display path is taken.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
Please re-state the problem that we are trying to solve in this issue.
2 equal expenses are displayed
What is the root cause of that problem?
When the invited user opens the expense report, reportActions isn't loaded fulled which causes this useEffect create the transaction thread report with iouAction is undefined. Then another iouAction is created for this transaction and the duplicate preview appears.
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.
Please re-state the problem that we are trying to solve in this issue.
When User B (invited with “Invite to chat only”) opens a newly submitted expense from the workspace chat, the expense details screen shows two identical expenses instead of one.
What is the root cause of that problem?
The transaction list shown on the expense report is built from the derived report transactions. For a single-expense report, the backend or client state can sometimes yield more than one transaction record for the same logical expense (e.g. for invite-to-chat-only users or due to timing). The UI does not deduplicate in this case, so every transaction for that report is shown and the user sees two identical rows.
When report.transactionCount === 1 but the collection has more than one transaction for that report, all of them are still displayed.
What changes do you think we should make in order to solve the problem?
Deduplicate the transaction list when the report represents a single expense (report.transactionCount === 1) but the list has more than one transaction: keep only the transaction that matches the most recent IOU report action’s IOUTransactionID. Add a helper in MoneyRequestReportUtils and use it in both ReportScreen and MoneyRequestReportView when building the list passed to the UI.
Solution – new code (git diff):
1. App/src/libs/MoneyRequestReportUtils.ts – Add import for getMostRecentIOURequestActionID and add helper, then export it.
--- a/App/src/libs/MoneyRequestReportUtils.ts+++ b/App/src/libs/MoneyRequestReportUtils.ts@@ -6,7 +6,7 @@ import CONST from '@src/CONST';
import type {OriginalMessageIOU, Policy, Report, ReportAction, ReportMetadata, Transaction} from '@src/types/onyx';
import {convertToDisplayString} from './CurrencyUtils';
import {isPaidGroupPolicy} from './PolicyUtils';
-import {getIOUActionForTransactionID, getOriginalMessage, isDeletedAction, isDeletedParentAction, isMoneyRequestAction} from './ReportActionsUtils';+import {getIOUActionForTransactionID, getMostRecentIOURequestActionID, getOriginalMessage, isDeletedAction, isDeletedParentAction, isMoneyRequestAction} from './ReportActionsUtils';
import {
getMoneyRequestSpendBreakdown,
getNonHeldAndFullAmount,
@@ -82,6 +82,28 @@ function getReportIDForTransaction(transactionItem: TransactionListItemType, IO
}
/**
+ * For single-expense reports, when the transaction list has more than one entry (e.g. duplicate for invite-to-chat-only),+ * return only the transaction that matches the most recent IOU report action so the UI shows one expense.+ */+function getDeduplicatedTransactionsForSingleExpenseReport(+ report: OnyxEntry<Report>,+ transactions: Transaction[],+ reportActions: ReportAction[],+): Transaction[] {+ if (!report || report.transactionCount !== 1 || transactions.length <= 1) {+ return transactions;+ }+ const mostRecentIOUActionID = getMostRecentIOURequestActionID(reportActions);+ const mostRecentAction = reportActions.find((action) => action.reportActionID === mostRecentIOUActionID);+ const transactionIDFromAction = getOriginalMessage(mostRecentAction)?.IOUTransactionID;+ if (!transactionIDFromAction) {+ return transactions;+ }+ const filtered = transactions.filter((transaction) => transaction.transactionID === transactionIDFromAction);+ return filtered.length > 0 ? filtered : transactions;+}++/**
* Filters all available transactions and returns the ones that belong to not removed action and not removed parent action.
*/
function getAllNonDeletedTransactions(transactions: OnyxCollection<Transaction>, reportActions: ReportAction[], isOffline = false, includeOrphanedTransactions = false) {
@@ -184,6 +206,7 @@ const getTotalAmountForIOUReportPreviewButton = (report: OnyxEntry<Report>, polic
export {
isActionVisibleOnMoneyRequestReport,
getThreadReportIDsForTransactions,
getReportIDForTransaction,
+ getDeduplicatedTransactionsForSingleExpenseReport,
getTotalAmountForIOUReportPreviewButton,
getAllNonDeletedTransactions,
2. App/src/pages/inbox/ReportScreen.tsx – Use the deduplication helper when building reportTransactions.
--- a/App/src/pages/inbox/ReportScreen.tsx+++ b/App/src/pages/inbox/ReportScreen.tsx@@ -47,7 +47,7 @@ import {
} from '@libs/MoneyRequestReportUtils';
import Navigation, {navigationRef} from '@libs/Navigation/Navigation';
(Add import for getDeduplicatedTransactionsForSingleExpenseReport in the existing MoneyRequestReportUtils import block.)
-import {getAllNonDeletedTransactions, shouldDisplayReportTableView, shouldWaitForTransactions as shouldWaitForTransactionsUtil} from '@libs/MoneyRequestReportUtils';+import {getAllNonDeletedTransactions, getDeduplicatedTransactionsForSingleExpenseReport, shouldDisplayReportTableView, shouldWaitForTransactions as shouldWaitForTransactionsUtil} from '@libs/MoneyRequestReportUtils';
3. App/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx – Use the deduplication helper when building transactions.
--- a/App/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx+++ b/App/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx@@ -23,7 +23,7 @@ import Log from '@libs/Log';
import {getAllNonDeletedTransactions, shouldDisplayReportTableView, shouldWaitForTransactions as shouldWaitForTransactionsUtil} from '@libs/MoneyRequestReportUtils';
(Add import for getDeduplicatedTransactionsForSingleExpenseReport in the existing MoneyRequestReportUtils import.)
-import {getAllNonDeletedTransactions, shouldDisplayReportTableView, shouldWaitForTransactions as shouldWaitForTransactionsUtil} from '@libs/MoneyRequestReportUtils';+import {getAllNonDeletedTransactions, getDeduplicatedTransactionsForSingleExpenseReport, shouldDisplayReportTableView, shouldWaitForTransactions as shouldWaitForTransactionsUtil} from '@libs/MoneyRequestReportUtils';
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.34-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@eh2077@stephanieelliott 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]
Issue is ready for payment but no BZ is assigned. @mallenexpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
Activity
melvin-bot commentedon Feb 25, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (
External)melvin-bot commentedon Feb 25, 2026
Triggered auto assignment to @stephanieelliott (
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.[-]Expense details - Two expenses appears in report for user invuted to chat only[/-][+][$250] Expense details - Two expenses appears in report for user invuted to chat only[/+]melvin-bot commentedon Feb 25, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022026630654198063486
MelvinBot commentedon Feb 25, 2026
🔍 Issue Analysis
Please re-state the problem that we are trying to solve in this issue.
When User B is invited to a workspace chat as "chat only" (via the
ACTIONABLE_MENTION_WHISPERresolution'invited'), and User A (the admin) submits a new expense, User B sees two duplicate expenses when opening the expense from the workspace chat. The expected behavior is that only one expense should be displayed.What is the root cause of that problem?
The most likely root cause is a race condition in
ReportScreen.tsxinvolving theincludeOrphanedTransactions=trueflag and the legacy transaction thread creation logic.Here's the sequence that causes duplicates:
The "invite to chat only" flow sends
ResolveActionableMentionWhisperwithresolution='invited'to the backend (src/libs/actions/Report/index.ts:4703). All member setup happens server-side — there is no "chat only" role in the frontend. The backend likely provides this user with limited report action data compared to a full workspace member.When the chat-only member opens the expense report (via
REPORT_PREVIEW→MoneyRequestReportPreview.openReportFromPreview()atsrc/components/ReportActionItem/MoneyRequestReportPreview/index.tsx:101-117),ReportScreenloads.ReportScreencollects transactions viauseReportTransactionsCollection(derived fromCOLLECTION.TRANSACTIONkeyed bytransaction.reportID) — this is independent of report actions.getAllNonDeletedTransactionsis called withincludeOrphanedTransactions=trueatsrc/pages/inbox/ReportScreen.tsx:342. This means transactions are included even when no matching IOU action exists in the loaded report actions (src/libs/MoneyRequestReportUtils.ts:86-104).The legacy transaction thread creation effect at
src/pages/inbox/ReportScreen.tsx:937-968fires becausegetIOUActionForReportID()returnsundefined(the IOU action hasn't loaded yet for this limited-access user). This creates a new optimistic IOU action + transaction thread.When the original IOU action arrives from the server, the report now has two IOU actions pointing to the same transaction — the optimistic one from step 5 and the real one from the server.
This results in the expense appearing twice in the expense report view.
A contributing factor is the dual-display architecture:
MoneyRequestReportActionsListrenders transactions in a table header (MoneyRequestReportTransactionList) and report actions in a FlatList below. The deduplication filter (IOU_ACTIONS_TO_FILTER_OUTatsrc/libs/MoneyRequestReportUtils.ts:34) only filtersCREATEandTRACKtypes. If the optimistic IOU action has a different type, it could bypass the filter and appear alongside the transaction table entry.What changes do you think we should make in order to solve the problem?
The fix should address the root cause — the legacy thread creation firing prematurely for chat-only members who have transaction data but delayed/missing IOU actions:
In
ReportScreen.tsx(lines 937-968): Add a guard to the legacy transaction thread creation effect that checks whether report actions have finished loading (e.g., checkisLoadingInitialReportActionsor verify the report actions collection is not empty) before deciding that an IOU action is missing. This prevents the race condition where the effect creates a duplicate optimistic IOU action before the real one arrives.Alternatively, in
getAllNonDeletedTransactionsatsrc/libs/MoneyRequestReportUtils.ts:86-104, consider not including orphaned transactions while report actions are still loading — only fall back toincludeOrphanedTransactionsbehavior when report actions have definitively loaded and the IOU action is confirmed missing.What alternative solutions did you explore? (Optional)
IOUTransactionIDappears at most once across both the transaction table and report actions list. This would be a safety net but doesn't fix the underlying race condition.Detailed Investigation
Root Cause Analysis
The investigation traced the data flow across three dimensions:
1. Chat-only invite flow (
src/libs/actions/Report/index.ts:4703-4785):resolution='invited'viaWRITE_COMMANDS.RESOLVE_ACTIONABLE_MENTION_WHISPERCONST.POLICY.ROLEonly hasADMIN,AUDITOR,USER); it's a billing-level concept (confirmed bychatOnlyActorListinsrc/types/onyx/PurchaseList.ts)2. Expense display architecture (
src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx):isActionVisibleOnMoneyRequestReport(src/libs/MoneyRequestReportUtils.ts:34-53) filtersCREATEandTRACKIOU types from the FlatList to prevent duplication with the tableDERIVED.REPORT_TRANSACTIONS_AND_VIOLATIONS(keyed bytransaction.reportID), independent of report actions3. View selection and race conditions (
src/pages/inbox/ReportScreen.tsx):shouldDisplayReportTableView(src/libs/MoneyRequestReportUtils.ts:113-129) decides between single-transaction view and table viewincludeOrphanedTransactions=true(line 342) includes transactions without matching IOU actionsgetIOUActionForReportIDreturns undefined, creating optimistic IOU actionsEvidence Chain
getAllNonDeletedTransactionsincludes orphaned transactions → transaction is visibleRelevant Code
src/pages/inbox/ReportScreen.tsx:342-includeOrphanedTransactions=truesrc/pages/inbox/ReportScreen.tsx:937-968- Legacy transaction thread creationsrc/libs/MoneyRequestReportUtils.ts:86-104-getAllNonDeletedTransactionssrc/libs/MoneyRequestReportUtils.ts:34-53-IOU_ACTIONS_TO_FILTER_OUTfiltersrc/components/ReportActionItem/MoneyRequestReportPreview/index.tsx:101-117- Navigation from previewsrc/libs/actions/Report/index.ts:4703-4785-resolveActionableMentionWhisperConfidence: Medium
This analysis is based on code tracing without production log confirmation. The exact data the backend sends to chat-only members is unknown (server-side code is not available). Production logs would confirm whether duplicate IOU actions are being created and which display path is taken.
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.nkdengineer commentedon Feb 25, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
2 equal expenses are displayed
What is the root cause of that problem?
When the invited user opens the expense report, reportActions isn't loaded fulled which causes this useEffect create the transaction thread report with
iouActionisundefined. Then another iouAction is created for this transaction and the duplicate preview appears.App/src/pages/Search/SearchMoneyRequestReportPage.tsx
Lines 229 to 270 in 3ecc7fd
What changes do you think we should make in order to solve the problem?
We should return early if the reportActions aren't loaded fully
App/src/pages/Search/SearchMoneyRequestReportPage.tsx
Lines 229 to 270 in 3ecc7fd
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.
abbasifaizan70 commentedon Feb 25, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When User B (invited with “Invite to chat only”) opens a newly submitted expense from the workspace chat, the expense details screen shows two identical expenses instead of one.
What is the root cause of that problem?
The transaction list shown on the expense report is built from the derived report transactions. For a single-expense report, the backend or client state can sometimes yield more than one transaction record for the same logical expense (e.g. for invite-to-chat-only users or due to timing). The UI does not deduplicate in this case, so every transaction for that report is shown and the user sees two identical rows.
Transaction list is built here:
App/src/pages/inbox/ReportScreen.tsx
Lines 341 to 342 in a8bf508
App/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx
Lines 117 to 119 in a8bf508
Filtering is done by
getAllNonDeletedTransactions, which does not consider single-expense reports:App/src/libs/MoneyRequestReportUtils.ts
Lines 86 to 105 in a8bf508
When
report.transactionCount === 1but the collection has more than one transaction for that report, all of them are still displayed.What changes do you think we should make in order to solve the problem?
Deduplicate the transaction list when the report represents a single expense (
report.transactionCount === 1) but the list has more than one transaction: keep only the transaction that matches the most recent IOU report action’sIOUTransactionID. Add a helper inMoneyRequestReportUtilsand use it in bothReportScreenandMoneyRequestReportViewwhen building the list passed to the UI.Solution – new code (git diff):
1.
App/src/libs/MoneyRequestReportUtils.ts– Add import forgetMostRecentIOURequestActionIDand add helper, then export it.2.
App/src/pages/inbox/ReportScreen.tsx– Use the deduplication helper when buildingreportTransactions.(Add import for
getDeduplicatedTransactionsForSingleExpenseReportin the existing MoneyRequestReportUtils import block.)3.
App/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx– Use the deduplication helper when buildingtransactions.(Add import for
getDeduplicatedTransactionsForSingleExpenseReportin the existing MoneyRequestReportUtils import.)webbygit commentedon Feb 25, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
16 remaining items
melvin-bot commentedon Mar 10, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Mar 10, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.34-2 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-03-17. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Mar 10, 2026
@eh2077 @stephanieelliott 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]
melvin-bot commentedon Mar 10, 2026
Current assignee @stephanieelliott is eligible for the Awaiting Payment assigner, not assigning anyone new.
melvin-bot commentedon Mar 17, 2026
Issue is ready for payment but no BZ is assigned. @mallenexpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
melvin-bot commentedon Mar 17, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
stephanieelliott commentedon Mar 18, 2026
Payment Summary
twisterdotcom commentedon Mar 19, 2026
@nkdengineer has submitted payment for this report on ND here.
SO: https://stackoverflowteams.com/c/expensify/questions/7582
Zapier Logs
Run ID: 00040eee-36ac-a5da-7fe9-8149059da0f4JmillsExpensify commentedon Mar 24, 2026
$250 approved for @eh2077