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-06-26] [$250] Expense - IOU is shown in preview & total is shown as loading,no expense details displayed #90692
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
The transaction is resolved through a chain at MoneyRequestView.tsx:195-200: parentReportActions → parentReportAction (via parentReportActionID) → IOUTransactionID → transaction. If the user never opened the IOU report directly before going offline, the IOU report's report actions (specifically the original CREATE action containing IOUTransactionID) and the transaction thread report were never fetched into Onyx.
The optimistic payment data in PayMoneyRequest.ts:262-303 only pushes updates for the chatReport, the iouReport, and the new PAY report action. It does not ensure the transaction thread report or the IOU report's original CREATE action (which holds the IOUTransactionID) are present in Onyx. So when the user navigates to the expense detail screen while offline, MoneyRequestView can't complete the lookup chain and falls back to the skeleton.
What changes do you think we should make in order to solve the problem?
The optimistic data for the payment flow in PayMoneyRequest.ts should ensure the transaction thread report and the relevant parent report action (CREATE action with IOUTransactionID) are available in Onyx when the payment is made. Specifically, getPayMoneyRequestParams should include the transaction thread report and the IOU report's existing report actions in its optimistic data so that MoneyRequestView can resolve the full chain (transactionThreadReport → parentReportAction → IOUTransactionID → transaction) even when offline.
Alternatively, MoneyRequestView could be made more resilient by attempting to resolve the transaction directly from the derived report transactions (which are already available from the workspace chat's data) rather than exclusively relying on the parentReportAction → IOUTransactionID chain when the transaction thread report or parent report actions are not loaded.
What alternative solutions did you explore? (Optional)
Another approach would be to pre-fetch the IOU report's actions and transaction thread report when the user views the payment confirmation screen (before tapping "Pay"), ensuring the data is in Onyx before the offline payment occurs. However, this is less robust since the user could go offline between viewing and paying.
Investigation details
Data flow of the bug:
User B sends IOU to User A → workspace chat gets a REPORT_PREVIEW action linking to the IOU report. Transaction data is sent as part of OpenReport for the workspace chat.
User A views the workspace chat but never opens the IOU report directly → the IOU report's individual REPORT_ACTIONS (CREATE action) and the transaction thread report are not in Onyx.
User A goes offline and taps "Pay with business account" → optimistic data updates chatReport (sets iouReportID=null), adds PAY action to iouReport, updates iouReport status. Does not populate transaction thread report or the IOU report's original CREATE action.
User navigates to LHN → IOU preview visible in workspace chat (transaction data exists from step 1).
User opens the expense → MoneyRequestView tries to load transactionThreadReport (not in Onyx) and resolve transaction via parentReportActions (CREATE action not in Onyx). Both fail → skeleton view returned.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
When a user pays a personal IOU with a business bank account offline, BaseKYCWall.selectPaymentMethod triggers moveIOUReportToPolicy → convertIOUReportToExpenseReport to convert the IOU into an expense report on the policy expense chat before the actual payment fires.
The optimistic data in convertIOUReportToExpenseReport updates the old DM chat and the IOU report itself, but it never updates the new workspace expense chat with the iouReportID, lastVisibleActionCreated, lastMessageText/Html, or hasOutstandingChildRequest. The old DM has its iouReportID cleared (see src/libs/actions/Report/index.ts#L6962-L6970) but no corresponding write attaches the moved report to the new chat:
After the move, payMoneyRequest runs against the (now-stale) workspace chat. Because that chat has no iouReportID and the previous step also issues iouReportID: null on whatever chatReport is passed in, the OfflineWithFeedback wrapper around the header keeps pendingFields.reimbursed: UPDATE indefinitely:
On Android (Hermes + Fabric), the report-actions/transactions collection selectors for MoneyRequestReportView resolve from the new chatReportID before the moved REPORT_PREVIEW action lands on the policy expense chat — so reportActions.length === 0, MoneyRequestReportView falls into the ReportActionsSkeletonView branch:
That's the "no expense details" empty state, combined with the dimmed header OfflineWithFeedback produces — what looks like a "loading" total.
What changes do you think we should make in order to solve the problem?
I'd extend convertIOUReportToExpenseReport so the new workspace expense chat is fully linked to the moved report in the same optimistic transaction. The minimum addition is a MERGE on ${REPORT}${optimisticPolicyExpenseChatReportID} that mirrors the data we strip from the old DM:
// To optimistically remove the GBR from the DM we need to update the hasOutstandingChildRequest param to false
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${oldChatReportID}`,
value: {
hasOutstandingChildRequest: false,
iouReportID: null,
},
});
+ // Attach the moved report to the destination policy expense chat so MoneyRequestReportView+ // can resolve actions/transactions via the new chatReportID immediately after navigation.+ optimisticData.push({+ onyxMethod: Onyx.METHOD.MERGE,+ key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticPolicyExpenseChatReportID}`,+ value: {+ iouReportID: reportID,+ hasOutstandingChildRequest: !isReportManuallyReimbursed(iouReport),+ lastVisibleActionCreated: movedExpenseReportAction.created,+ lastMessageText: getReportActionText(movedReportAction),+ lastMessageHtml: getReportActionHtml(movedReportAction),+ },+ });+ failureData.push({+ onyxMethod: Onyx.METHOD.MERGE,+ key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticPolicyExpenseChatReportID}`,+ value: {iouReportID: null},+ });
And in payMoneyRequest, only clear iouReportID on the chat when the report is not mid-move to a policy — otherwise the second optimistic write races the first and wipes the link we just established:
- const optimisticChatReport = {- ...chatReport,- lastReadTime: DateUtils.getDBTime(),- hasOutstandingChildRequest: hasOutstandingChildRequest(chatReport, iouReport?.reportID, currentUserEmailParam, currentUserAccountIDParam, allTransactionViolations, undefined),- iouReportID: null,- lastMessageText: getReportActionText(optimisticIOUReportAction),- lastMessageHtml: getReportActionHtml(optimisticIOUReportAction),- };+ const isMovedToPolicy = chatReport.reportID !== iouReport?.chatReportID;+ const optimisticChatReport = {+ ...chatReport,+ lastReadTime: DateUtils.getDBTime(),+ hasOutstandingChildRequest: hasOutstandingChildRequest(chatReport, iouReport?.reportID, currentUserEmailParam, currentUserAccountIDParam, allTransactionViolations, undefined),+ // Keep the link when the IOU was just moved to this policy expense chat;+ // otherwise the workspace chat loses its iouReportID immediately after the move.+ iouReportID: isMovedToPolicy ? iouReport?.reportID : null,+ lastMessageText: getReportActionText(optimisticIOUReportAction),+ lastMessageHtml: getReportActionHtml(optimisticIOUReportAction),+ };
The same MoneyRequestReportView skeleton fallback should also be hardened so that an empty reportActions list while offline doesn't render ReportActionsSkeletonView for a report we do have (report?.total present, transactions in Onyx) — guarding the early return at L224 with !isOffline makes the moved/paid expense visible immediately on Android too.
What alternative solutions did you explore? (Optional)
Skip the IOU→policy move entirely when offline and just run payMoneyRequest. Rejected: it diverges the offline/online flows and the BE expects the move to have happened before settlement when paying as business.
buildOptimisticTaskCommentReportAction retroactively stamps actorAccountID onto the report action after the body has been built — but the body's person array and avatar field were already baked from the current user, not the guide. The patch-up at the end overwrites only one of the three fields that identify the actor:
constreportAction=buildOptimisticAddCommentReportAction({text,reportID: taskReportID, ...});// ^ actorAccountID is not threaded into the nested builder
Inside that nested builder, with no actorAccountID argument, accountID falls through to the current user:
Only actorAccountID is fixed. person[0].text and avatar still point at the freshly-signed-up user — whose displayName falls back to their login (their email) and whose avatar is the default-generated fallback URL since they haven't uploaded one yet. That's exactly the symptom in the bug report: the actor renders as user@tstsg.com with a fallback avatar instead of qa.guide@team.expensify.com with the guide's avatar.
What changes do you think we should make in order to solve the problem?
Thread actorAccountID into the nested builder so the person/avatar fields are computed from the guide's account from the start. The retroactive patch then becomes redundant.
- function buildOptimisticTaskCommentReportAction(- taskReportID: string,- taskTitle: string,- taskAssigneeAccountID: number,- text: string,- parentReportID: string | undefined,- actorAccountID?: number,- createdOffset = 0,- currentUserEmail?: string,- currentUserAccountID?: number,- ): OptimisticReportAction {- const reportAction = buildOptimisticAddCommentReportAction({- text,- reportID: taskReportID,- createdOffset,- currentUserEmail,- currentUserAccountID,- delegateAccountIDParam: undefined,- });+ function buildOptimisticTaskCommentReportAction(+ taskReportID: string,+ taskTitle: string,+ taskAssigneeAccountID: number,+ text: string,+ parentReportID: string | undefined,+ actorAccountID?: number,+ createdOffset = 0,+ currentUserEmail?: string,+ currentUserAccountID?: number,+ ): OptimisticReportAction {+ const reportAction = buildOptimisticAddCommentReportAction({+ text,+ reportID: taskReportID,+ createdOffset,+ currentUserEmail,+ currentUserAccountID,+ actorAccountID,+ delegateAccountIDParam: undefined,+ });
...
- if (actorAccountID) {- reportAction.reportAction.actorAccountID = actorAccountID;- }+ // actorAccountID is now applied inside buildOptimisticAddCommentReportAction, so person/avatar+ // are built from the guide's personal details instead of the current user's.
return reportAction;
}
buildOptimisticAddCommentReportAction already accepts actorAccountID in its BuildOptimisticAddCommentReportActionParams and uses it at L6325 — we just have to stop dropping it on the way through. With this change:
accountID resolves to the guide account
person[0].text reads allPersonalDetails[guideAccountID].displayName → the merge at L11703-L11711 wrote displayName: assignedGuideEmail for this exact account, so for the bug's scenario it renders as qa.guide@team.expensify.com (or "Setup Specialist" while the assigned-guide email is still pending from the backend, but never the user's email)
avatar reads allPersonalDetails[guideAccountID].avatar → the guide's actual avatar once the personal-details fetch resolves; until then, the same fallback the merge wrote — never the current user's avatar
The if (actorAccountID) { actorAccountID = ... } patch at L6485-L6487 becomes a no-op (the value is already set inside the builder) and can be removed.
I'd also follow the existing module-level allPersonalDetails cache: at the moment prepareOnboardingOnyxData runs, Onyx.merge at L11703 is async and the module cache reflects the merge on the next tick. Since these optimistic actions don't ship to the UI until the API call's optimisticData is applied (which happens after the function returns), the merge will have landed by render time — so the lookup at L6340/L6345 will find the guide's row, not miss it.
What alternative solutions did you explore?
I considered extending the retroactive patch at L6485-L6487 to also rebuild person and avatar. That works but duplicates the exact computation already present at L6340/L6345, and creates two places to update if those fields ever change shape. Pushing actorAccountID through the constructor keeps the rule "actor is what accountID decides" in one location.
I considered leaving buildOptimisticTaskCommentReportAction alone and instead populating person/avatar at the onboarding call site (L11840) with values pulled from allPersonalDetails[assignedGuideAccountID]. That fixes this caller specifically but leaves the helper subtly broken for every other caller that passes a non-current-user actorAccountID — the bug would re-surface anywhere else the same mistake is repeated.
changed the title [-]Expense - IOU is shown in preview & total is shown as loading,no expense details displayed[/-][+][$250] Expense - IOU is shown in preview & total is shown as loading,no expense details displayed[/+]on May 14, 2026
⚠️ @dilshodmackbook-sketch Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
⚠️ @dilshodmackbook-sketch Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
Please re-state the problem that we are trying to solve in this issue.
When User A pays an IOU offline without having previously opened the IOU report, the expense detail view shows a loading skeleton instead of the transaction details. User A can see the IOU in the workspace chat preview, but opening the expense displays only a loading state with no expense details visible. The expected behavior is to display the full expense report and transaction details even when the underlying transaction thread report or parent CREATE action was never fetched online.
What is the root cause of that problem?
The root cause is in src/libs/actions/IOU/PayMoneyRequest.ts:247–303 in the getPayMoneyRequestParams function. When processing an offline payment, the function pushes optimistic updates for the chatReport, iouReport, PAY action, and report preview, but it never ensures that the transaction thread report or the IOU report's original CREATE action (which contains IOUTransactionID) are present in Onyx. If User A never opened the IOU report directly before going offline, those records were never fetched from the server.
When MoneyRequestView mounts (lines 195–200), it attempts to resolve parentReportActions[transactionThreadReport.parentReportActionID] to find the linked transaction. Since the parent CREATE action is missing from Onyx, linkedTransactionID and transaction remain undefined. This triggers the gate at line 893:
if ((!readonly && !transactionThreadReport?.reportID) || !transaction?.transactionID) return <ReportActionsSkeletonView />;
This is the 'total is loading, no details' symptom reported. The issue is consistently reproducible on Android (the platform in the bug report) because Android does not prefetch report action threads during LHN rendering — iOS may prefetch them in some app states, which is why the bug is platform-specific in practice even though the root cause is platform-agnostic.
The code already conditionally pushes a MERGE for the report preview action when it exists locally — the same pattern should apply to the transaction thread report and parent CREATE action.
What changes do you think we should make in order to solve the problem?
File: src/libs/actions/IOU/PayMoneyRequest.ts Function: getPayMoneyRequestParams Description: After the existing optimistic updates, conditionally push two additional MERGE operations: (a) the IOU report's CREATE action into REPORT_ACTIONS[iouReportID] when the parent CREATE action with IOUTransactionID is not already in Onyx, and (b) the transaction thread report into REPORT[transactionThreadReportID] when missing. This ensures MoneyRequestView's parentReportActions → parentReportAction → IOUTransactionID → transaction chain resolves even when the user never opened the IOU report online.
Exact code to add (after line 303, before the return statement):
// Ensure the transaction thread report and parent CREATE action are present in Onyx so the// expense detail view can resolve transaction details when opened offline (e.g. directly after// an offline pay). Without this, MoneyRequestView falls back to ReportActionsSkeletonView.constiouCreateAction=getIOUActionForReportID(iouReport?.reportID,undefined);consttransactionThreadReportID=iouCreateAction?.childReportID;// Guard: only proceed if both values are non-null strings — an absent or malformed// iouCreateAction means the IOU has no CREATE action in local Onyx, in which case// we cannot construct a valid MERGE payload and must skip to avoid writing partial state.if(iouCreateAction&&typeofiouCreateAction.reportActionID==='string'&&iouCreateAction.reportActionID.length>0&&typeoftransactionThreadReportID==='string'&&transactionThreadReportID.length>0){// Only merge the CREATE action if it is not already present in Onyx to avoid// overwriting a more-complete server-fetched version with a stale local copy.constexistingCreateAction=allReportActions?.[iouReport?.reportID??'']?.[iouCreateAction.reportActionID];if(!existingCreateAction){onyxData.optimisticData?.push({onyxMethod: Onyx.METHOD.MERGE,key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`,value: {[iouCreateAction.reportActionID]: iouCreateAction,},});}// Only merge the thread report stub if it is not already present in Onyx.constexistingThreadReport=allReports?.[transactionThreadReportID];if(!existingThreadReport?.reportID){onyxData.optimisticData?.push({onyxMethod: Onyx.METHOD.MERGE,key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`,value: {reportID: transactionThreadReportID,parentReportID: iouReport?.reportID,parentReportActionID: iouCreateAction.reportActionID,},});}}
The existing Onyx state checks (existingCreateAction and existingThreadReport?.reportID) ensure we never overwrite a server-fetched record with a stale optimistic stub. The string-length guards on reportActionID and transactionThreadReportID prevent writing keys like REPORT_ACTIONS_ or REPORT_ to Onyx if either value is unexpectedly empty.
Blast radius: The change is scoped to optimistic data initialization in the offline payment flow. It only adds missing Onyx records that should already exist, ensuring the expense detail view's dependency chain resolves without altering payment logic or report state transitions.
What alternative solutions did you explore? (Optional)
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.15-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@thesahindia 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]. If no checklist is needed for this issue, you can click: [no checklist button]
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
MelvinBot commentedon May 14, 2026
Proposal
What is the root cause of that problem?
When User A opens the expense after paying an IOU offline,
MoneyRequestView.tsx:893returns a skeleton view because it cannot resolve thetransaction:The transaction is resolved through a chain at
MoneyRequestView.tsx:195-200:parentReportActions→parentReportAction(viaparentReportActionID) →IOUTransactionID→transaction. If the user never opened the IOU report directly before going offline, the IOU report's report actions (specifically the original CREATE action containingIOUTransactionID) and the transaction thread report were never fetched into Onyx.The optimistic payment data in
PayMoneyRequest.ts:262-303only pushes updates for thechatReport, theiouReport, and the new PAY report action. It does not ensure the transaction thread report or the IOU report's original CREATE action (which holds theIOUTransactionID) are present in Onyx. So when the user navigates to the expense detail screen while offline,MoneyRequestViewcan't complete the lookup chain and falls back to the skeleton.What changes do you think we should make in order to solve the problem?
The optimistic data for the payment flow in
PayMoneyRequest.tsshould ensure the transaction thread report and the relevant parent report action (CREATE action withIOUTransactionID) are available in Onyx when the payment is made. Specifically,getPayMoneyRequestParamsshould include the transaction thread report and the IOU report's existing report actions in its optimistic data so thatMoneyRequestViewcan resolve the full chain (transactionThreadReport→parentReportAction→IOUTransactionID→transaction) even when offline.Alternatively,
MoneyRequestViewcould be made more resilient by attempting to resolve the transaction directly from the derived report transactions (which are already available from the workspace chat's data) rather than exclusively relying on theparentReportAction→IOUTransactionIDchain when the transaction thread report or parent report actions are not loaded.What alternative solutions did you explore? (Optional)
Another approach would be to pre-fetch the IOU report's actions and transaction thread report when the user views the payment confirmation screen (before tapping "Pay"), ensuring the data is in Onyx before the offline payment occurs. However, this is less robust since the user could go offline between viewing and paying.
Investigation details
Data flow of the bug:
REPORT_PREVIEWaction linking to the IOU report. Transaction data is sent as part ofOpenReportfor the workspace chat.REPORT_ACTIONS(CREATE action) and the transaction thread report are not in Onyx.chatReport(setsiouReportID=null), adds PAY action toiouReport, updatesiouReportstatus. Does not populate transaction thread report or the IOU report's original CREATE action.MoneyRequestViewtries to loadtransactionThreadReport(not in Onyx) and resolvetransactionviaparentReportActions(CREATE action not in Onyx). Both fail → skeleton view returned.Key code locations:
MoneyRequestView.tsx:893MoneyRequestView.tsx:195-200PayMoneyRequest.ts:262-303chatReport.iouReportIDset to null:PayMoneyRequest.ts:251MoneyReportView.tsx:241Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.mukhrr commentedon May 14, 2026
Proposal
What is the root cause of that problem?
When a user pays a personal IOU with a business bank account offline,
BaseKYCWall.selectPaymentMethodtriggersmoveIOUReportToPolicy→convertIOUReportToExpenseReportto convert the IOU into an expense report on the policy expense chat before the actual payment fires.The optimistic data in
convertIOUReportToExpenseReportupdates the old DM chat and the IOU report itself, but it never updates the new workspace expense chat with theiouReportID,lastVisibleActionCreated,lastMessageText/Html, orhasOutstandingChildRequest. The old DM has itsiouReportIDcleared (seesrc/libs/actions/Report/index.ts#L6962-L6970) but no corresponding write attaches the moved report to the new chat:App/src/libs/actions/Report/index.ts
Lines 6909 to 6970 in 1b89b63
After the move,
payMoneyRequestruns against the (now-stale) workspace chat. Because that chat has noiouReportIDand the previous step also issuesiouReportID: nullon whateverchatReportis passed in, theOfflineWithFeedbackwrapper around the header keepspendingFields.reimbursed: UPDATEindefinitely:App/src/libs/actions/IOU/PayMoneyRequest.ts
Lines 247 to 297 in 1b89b63
On Android (Hermes + Fabric), the report-actions/transactions collection selectors for
MoneyRequestReportViewresolve from the newchatReportIDbefore the movedREPORT_PREVIEWaction lands on the policy expense chat — soreportActions.length === 0,MoneyRequestReportViewfalls into theReportActionsSkeletonViewbranch:App/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx
Lines 222 to 226 in 1b89b63
That's the "no expense details" empty state, combined with the dimmed header
OfflineWithFeedbackproduces — what looks like a "loading" total.What changes do you think we should make in order to solve the problem?
I'd extend
convertIOUReportToExpenseReportso the new workspace expense chat is fully linked to the moved report in the same optimistic transaction. The minimum addition is a MERGE on${REPORT}${optimisticPolicyExpenseChatReportID}that mirrors the data we strip from the old DM:// To optimistically remove the GBR from the DM we need to update the hasOutstandingChildRequest param to false optimisticData.push({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${oldChatReportID}`, value: { hasOutstandingChildRequest: false, iouReportID: null, }, }); + // Attach the moved report to the destination policy expense chat so MoneyRequestReportView + // can resolve actions/transactions via the new chatReportID immediately after navigation. + optimisticData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticPolicyExpenseChatReportID}`, + value: { + iouReportID: reportID, + hasOutstandingChildRequest: !isReportManuallyReimbursed(iouReport), + lastVisibleActionCreated: movedExpenseReportAction.created, + lastMessageText: getReportActionText(movedReportAction), + lastMessageHtml: getReportActionHtml(movedReportAction), + }, + }); + failureData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticPolicyExpenseChatReportID}`, + value: {iouReportID: null}, + });And in
payMoneyRequest, only cleariouReportIDon the chat when the report is not mid-move to a policy — otherwise the second optimistic write races the first and wipes the link we just established:The same
MoneyRequestReportViewskeleton fallback should also be hardened so that an emptyreportActionslist while offline doesn't renderReportActionsSkeletonViewfor a report we do have (report?.totalpresent, transactions in Onyx) — guarding the early return at L224 with!isOfflinemakes the moved/paid expense visible immediately on Android too.What alternative solutions did you explore? (Optional)
setNavigationActionToMicrotaskQueue— already done in PR Fix wrong next action message, missing Pay button after bypassing approver & approving offline #72892 for a sibling bug; it improves timing but doesn't fix the missing optimistic link, so the symptom returns the next time the user navigates back into the report.payMoneyRequest. Rejected: it diverges the offline/online flows and the BE expects the move to have happened before settlement when paying as business.melvin-bot commentedon May 14, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (
External)David-2002065 commentedon May 14, 2026
Proposal
What is the root cause of that problem?
buildOptimisticTaskCommentReportActionretroactively stampsactorAccountIDonto the report action after the body has been built — but the body'spersonarray andavatarfield were already baked from the current user, not the guide. The patch-up at the end overwrites only one of the three fields that identify the actor:https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L6459
Inside that nested builder, with no
actorAccountIDargument,accountIDfalls through to the current user:https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L6325
And
accountIDis what drives the actor's display name and avatar:https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L6336-L6345
After the builder returns, the outer function does:
https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L6485-L6487
Only
actorAccountIDis fixed.person[0].textandavatarstill point at the freshly-signed-up user — whosedisplayNamefalls back to their login (their email) and whoseavataris the default-generated fallback URL since they haven't uploaded one yet. That's exactly the symptom in the bug report: the actor renders asuser@tstsg.comwith a fallback avatar instead ofqa.guide@team.expensify.comwith the guide's avatar.The setup specialist's personal details do exist on the device by this point —
prepareOnboardingOnyxDataOnyx.merges them at https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L11703-L11711 — but the renderer readsperson/avatarstraight off the report action, so a wrong identity baked at build time wins.What changes do you think we should make in order to solve the problem?
Thread
actorAccountIDinto the nested builder so theperson/avatarfields are computed from the guide's account from the start. The retroactive patch then becomes redundant.buildOptimisticAddCommentReportActionalready acceptsactorAccountIDin itsBuildOptimisticAddCommentReportActionParamsand uses it at L6325 — we just have to stop dropping it on the way through. With this change:accountIDresolves to the guide accountperson[0].textreadsallPersonalDetails[guideAccountID].displayName→ the merge at L11703-L11711 wrotedisplayName: assignedGuideEmailfor this exact account, so for the bug's scenario it renders asqa.guide@team.expensify.com(or "Setup Specialist" while the assigned-guide email is still pending from the backend, but never the user's email)avatarreadsallPersonalDetails[guideAccountID].avatar→ the guide's actual avatar once the personal-details fetch resolves; until then, the same fallback the merge wrote — never the current user's avatarThe
if (actorAccountID) { actorAccountID = ... }patch at L6485-L6487 becomes a no-op (the value is already set inside the builder) and can be removed.I'd also follow the existing module-level
allPersonalDetailscache: at the momentprepareOnboardingOnyxDataruns,Onyx.mergeat L11703 is async and the module cache reflects the merge on the next tick. Since these optimistic actions don't ship to the UI until the API call'soptimisticDatais applied (which happens after the function returns), the merge will have landed by render time — so the lookup at L6340/L6345 will find the guide's row, not miss it.What alternative solutions did you explore?
I considered extending the retroactive patch at L6485-L6487 to also rebuild
personandavatar. That works but duplicates the exact computation already present at L6340/L6345, and creates two places to update if those fields ever change shape. PushingactorAccountIDthrough the constructor keeps the rule "actor is whataccountIDdecides" in one location.I considered leaving
buildOptimisticTaskCommentReportActionalone and instead populatingperson/avatarat the onboarding call site (L11840) with values pulled fromallPersonalDetails[assignedGuideAccountID]. That fixes this caller specifically but leaves the helper subtly broken for every other caller that passes a non-current-useractorAccountID— the bug would re-surface anywhere else the same mistake is repeated.melvin-bot commentedon May 14, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022054952823579625885
[-]Expense - IOU is shown in preview & total is shown as loading,no expense details displayed[/-][+][$250] Expense - IOU is shown in preview & total is shown as loading,no expense details displayed[/+]github-actions commentedon May 14, 2026
github-actions commentedon May 14, 2026
aswin-s commentedon May 14, 2026
Please re-state the problem that we are trying to solve in this issue.
When User A pays an IOU offline without having previously opened the IOU report, the expense detail view shows a loading skeleton instead of the transaction details. User A can see the IOU in the workspace chat preview, but opening the expense displays only a loading state with no expense details visible. The expected behavior is to display the full expense report and transaction details even when the underlying transaction thread report or parent CREATE action was never fetched online.
What is the root cause of that problem?
The root cause is in
src/libs/actions/IOU/PayMoneyRequest.ts:247–303in thegetPayMoneyRequestParamsfunction. When processing an offline payment, the function pushes optimistic updates for the chatReport, iouReport, PAY action, and report preview, but it never ensures that the transaction thread report or the IOU report's original CREATE action (which contains IOUTransactionID) are present in Onyx. If User A never opened the IOU report directly before going offline, those records were never fetched from the server.When
MoneyRequestViewmounts (lines 195–200), it attempts to resolveparentReportActions[transactionThreadReport.parentReportActionID]to find the linked transaction. Since the parent CREATE action is missing from Onyx,linkedTransactionIDandtransactionremain undefined. This triggers the gate at line 893:This is the 'total is loading, no details' symptom reported. The issue is consistently reproducible on Android (the platform in the bug report) because Android does not prefetch report action threads during LHN rendering — iOS may prefetch them in some app states, which is why the bug is platform-specific in practice even though the root cause is platform-agnostic.
Working analog (same file, successful pattern):
App/src/libs/actions/IOU/PayMoneyRequest.ts
Lines 290 to 298 in 7152d98
The code already conditionally pushes a MERGE for the report preview action when it exists locally — the same pattern should apply to the transaction thread report and parent CREATE action.
What changes do you think we should make in order to solve the problem?
File:
src/libs/actions/IOU/PayMoneyRequest.tsFunction:
getPayMoneyRequestParamsDescription: After the existing optimistic updates, conditionally push two additional MERGE operations: (a) the IOU report's CREATE action into
REPORT_ACTIONS[iouReportID]when the parent CREATE action with IOUTransactionID is not already in Onyx, and (b) the transaction thread report intoREPORT[transactionThreadReportID]when missing. This ensuresMoneyRequestView'sparentReportActions→parentReportAction→IOUTransactionID→transactionchain resolves even when the user never opened the IOU report online.Exact code to add (after line 303, before the return statement):
The existing Onyx state checks (
existingCreateActionandexistingThreadReport?.reportID) ensure we never overwrite a server-fetched record with a stale optimistic stub. The string-length guards onreportActionIDandtransactionThreadReportIDprevent writing keys likeREPORT_ACTIONS_orREPORT_to Onyx if either value is unexpectedly empty.Blast radius: The change is scoped to optimistic data initialization in the offline payment flow. It only adds missing Onyx records that should already exist, ensuring the expense detail view's dependency chain resolves without altering payment logic or report state transitions.
What alternative solutions did you explore? (Optional)
N/A
43 remaining items
melvin-bot commentedon Jun 19, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.15-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-06-26. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jun 19, 2026
@thesahindia 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]. If no checklist is needed for this issue, you can click: [no checklist button]
melvin-bot commentedon Jun 22, 2026
@thesahindia Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
thesahindia commentedon Jun 23, 2026
We just need to add a test case. Steps below:
Pre condition:
Have 2 accounts: User A and User B
melvin-bot commentedon Jun 25, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jun 25, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jun 28, 2026
Payment Summary
Contributor+: @thesahindia due $250 via NewDot
^ Test case created. Thx
garrettmknight commentedon Aug 7, 2026
$250 approved for @thesahindia