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
[$175] Expense - When expense is moved to a new report offline it's not greyed out in the report #107823
Version Number: 9.5.53-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:#106704 Email or phone of affected tester (no customers): n/a Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Mac 26.5.1 Safari/Chrome, iPhone 13 iOS 26.6 App Component: Money Requests
Create two different reports with expenses in the workspace chat
Open an expense that is on a report
Go offline
Click the Report field.
Select a different report.
Navigate to the report to which the expense was moved
Expected Result:
The moved expense should be greyed out and show a pending state in the report preview, in the opened report and when opening the moved expense itself
Actual Result:
When an expense is moved to a new report while offline, it isn't greyed out in the report itself, only in the report preview.
When the user has multiple reports and opens the report after moving the expense, it's difficult to identify which expense was moved.
changed the title [-]Expense - When expense is moved to a new report offline it's not greyed out in the report[/-][+][$175] Expense - When expense is moved to a new report offline it's not greyed out in the report[/+]on Nov 24, 2026
Pending state is recorded on the report action, but not consistently on the moved expense. A normal same-currency move creates a pending destination IOU action without marking the transaction pending. The destination report row checks the transaction—not that action—so the moved expense remains undimmed offline.
Opening the expense has a related mismatch: its outer pending-state wrapper checks the expense thread’s existing CREATED action, which the move does not mark pending.
Confidence: Medium. The code path is verified, including against the reported staging version; browser reproduction was not performed.
The move marks the destination IOU action pending, but only adds transaction-level pending state when clearing converted amounts: Transaction.ts:1172–1239.
Challenge: Some cross-currency moves already set transaction pending state, masking the report-row bug. This rules out a universal opacity-rendering failure.
Action-driven previews can dim independently. However, the issue’s wording does not establish whether “report preview” means the individual expense preview or the aggregate report card; that distinction remains unverified.
What changes do you think we should make in order to solve the problem?
Consistently mark each moved transaction’s pendingFields.reportID as pending in the shared move update. Clear it on success and restore its previous value on failure, preserving unrelated pending fields.
Make the opened expense’s outer feedback wrapper recognize that move marker. Adding the marker alone covers the report row and Report field, not the entire opened expense. Avoid applying opacity twice.
Add regression coverage for same-currency moves between existing reports: moved expense pending, untouched expenses unchanged, success cleanup, failure rollback, and opened-expense feedback. Retain cross-currency coverage.
What alternative solutions did you explore? (Optional)
Changing only the report row would leave opened expenses uncovered. Marking the entire destination report pending would also affect expenses that were not moved.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/107823) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
When a user moves an existing expense to a different report while offline (via the expense's Report field), the moved expense is only greyed out in the chat report preview. Inside the destination report's expense list and when opening the moved expense itself (both in narrow layout and in desktop Wide RHP), the moved expense is rendered at full opacity with no pending state.
What is the root cause of that problem?
Missing transaction-level move pending marker in getChangeTransactionsReportOnyxData (src/libs/actions/Transaction.ts:1202-1240):
Moving an expense sets pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD on the optimistic destination IOU report action (newIOUAction, src/libs/actions/Transaction.ts:1185), which is why TransactionPreviewContent in the report preview dims the card (src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx:263).
However, on the TRANSACTION entry itself (src/libs/actions/Transaction.ts:1202-1217), getChangeTransactionsReportOnyxData only sets pendingAction: UPDATE when shouldClearAmount is true (cross-currency moves) and never sets pendingFields.reportID.
Because MoneyRequestReportTransactionItem derives row opacity from getTransactionPendingAction(transaction) (src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx:179,278), a same-currency moved expense is not dimmed in the opened report.
Opened expense view ignores the transaction's move pending state on both panes:
In src/pages/inbox/report/ReportActionItemContentCreated.tsx:95, the outer <OfflineWithFeedback> wrapping <MoneyRequestView> only reads action?.pendingAction (the existing transaction thread's CREATED action, which is not pending for a pre-existing expense).
On desktop Web (Wide RHP), the receipt pane is rendered as a sibling outsideReportActionItemContentCreated via WideRHPReceiptPanel.tsx:98 (multi-expense report) and MoneyRequestReportView.tsx:254 (single-expense report). Inside src/components/ReportActionItem/MoneyRequestReceiptView.tsx:338-349, getPendingFieldAction only falls back to transaction?.pendingAction when isDisplayedInWideRHP is true — never checking transaction?.pendingFields?.reportID — so the entire left receipt column stays undimmed on desktop even if ReportActionItemContentCreated is updated.
Conversely, inside src/components/ReportActionItem/MoneyRequestView.tsx:413,630,1859, getPendingFieldAction only suppresses field-level <OfflineWithFeedback> wrappers when transaction?.pendingAction is set. Simply dimming ReportActionItemContentCreated on transaction?.pendingFields?.reportID without informing MoneyRequestView causes the Report field (line 1859) — and any other offline-edited field or inline narrow receipt — to render nested <OfflineWithFeedback> wrappers and double-dim (0.5 × 0.5).
What changes do you think we should make in order to solve the problem?
Track move pending state via pendingFields.reportID in src/libs/actions/Transaction.ts (getChangeTransactionsReportOnyxData, lines 1202–1240):
In optimisticData, merge pendingFields: {...transaction.pendingFields, reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE} onto each moved TRANSACTION entry (preserving unrelated pending fields from prior offline edits).
In successData, clear pendingFields: {reportID: null}.
In failureData, restore pendingFields: {reportID: transaction.pendingFields?.reportID ?? null}.
This immediately causes MoneyRequestReportTransactionItem (via getTransactionPendingAction) to grey out only the moved expense row inside the opened destination report without affecting untouched sibling expenses.
Guard getTransactionPendingAction against falsy pendingFields values (src/libs/TransactionUtils/index.ts:1322-1328):
Check Object.values(transaction?.pendingFields ?? {}).some(Boolean) instead of Object.keys(transaction?.pendingFields ?? {}).length > 0 (aligning with SearchUIUtils.ts:1573 and spendDataSignature.ts:49), ensuring cleared {reportID: null} / undefined entries can never leave a transaction stuck in a pending state.
Dim the opened expense details pane and prevent double opacity (src/pages/inbox/report/ReportActionItemContentCreated.tsx:94-111 and src/components/ReportActionItem/MoneyRequestView.tsx:180-220,630,1303):
In ReportActionItemContentCreated.tsx, compute expensePendingAction = action?.pendingAction ?? transaction?.pendingFields?.reportID (transaction is already subscribed at line 48, adding zero new Onyx subscriptions), pass it to <OfflineWithFeedback pendingAction={expensePendingAction}>, and pass hasParentPendingAction={!!expensePendingAction} to <MoneyRequestView> (mirroring the existing hasParentPendingAction pattern on MoneyRequestReceiptView).
In MoneyRequestView.tsx, accept optional hasParentPendingAction = false, return undefined from getPendingFieldAction when hasParentPendingAction || !!pendingAction is true (keeping pendingAction = transaction?.pendingAction untouched so shouldShowPaid at line 414 and shouldShowConvertedAmount at line 734 keep their exact behavior), and forward hasParentPendingAction={hasParentPendingAction || !!pendingAction} to the narrow-layout inline <MoneyRequestReceiptView> at line 1303.
Dim the desktop Wide RHP receipt pane consistently (src/components/ReportActionItem/MoneyRequestReceiptView.tsx:340-349):
When isDisplayedInWideRHP is true (and hasParentPendingAction is false), return transaction?.pendingFields?.[fieldPath] ?? pendingAction ?? transaction?.pendingFields?.reportID from getPendingFieldAction so both the receipt image and empty receipt state dim alongside the details pane on desktop without double-dimming when the parent report itself is pending (MoneyRequestReportView.tsx:258) or in narrow layout.
Add unit & UI regression tests:
Extend tests/unit/TransactionTest.ts to verify same-currency offline moves set pendingFields.reportID = UPDATE (preserving unrelated pendingFields), clear it on success, and restore the prior value on failure while keeping existing cross-currency shouldClearAmount behavior intact.
Add UI test coverage verifying that a moved expense with pendingFields.reportID = UPDATE dims in MoneyRequestReportTransactionItem, in ReportActionItemContentCreated/MoneyRequestView (without double-dimming the Report field), and in MoneyRequestReceiptView when isDisplayedInWideRHP is true.
What alternative solutions did you explore? (Optional)
Setting transaction.pendingAction = UPDATE unconditionally in getChangeTransactionsReportOnyxData: Avoided because transaction.pendingAction has broader semantic side effects across the app — for example, ReportUtils.hasUpdatedTotal (src/libs/ReportUtils.ts:13118) treats any transaction with pendingAction on a mixed-currency report as invalidating the report total, and MoneyRequestView.tsx:734 (shouldShowConvertedAmount) hides valid converted amounts when pendingAction is set even when shouldClearAmount is false. Scoping the move marker to pendingFields.reportID avoids all of these regressions while cleanly covering the report row, narrow expense view, and desktop Wide RHP receipt pane.
Please re-state the problem that we are trying to solve in this issue.
Moving an existing expense to a different report while offline (through the expense's Report field) leaves the moved expense at full opacity in the destination report's expense list and when opening the moved expense itself, on narrow layout and on desktop Wide RHP. Only the chat report preview dims it. The issue expects the moved expense to be greyed out with a pending state in three places: the report preview (already works), the opened destination report's expense list, and when opening the moved expense itself.
What is the root cause of that problem?
The move records pending state on the destination IOU action but never on the transaction itself, so every surface that dims from the transaction sees a clean expense. Verified on baseline e91964cb:
getChangeTransactionsReportOnyxData (src/libs/actions/Transaction.ts) sets pendingAction: UPDATE on the TRANSACTION entry only when shouldClearAmount is true, i.e. cross-currency moves. It never sets pendingFields.reportID, so a same-currency move leaves the transaction with no pending marker at all.
MoneyRequestReportTransactionItem (src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx) derives row opacity from getTransactionPendingAction(transaction), so a same-currency moved expense is not dimmed in the opened report.
ReportActionItemContentCreated.tsx wraps MoneyRequestView in OfflineWithFeedback pendingAction={action?.pendingAction}, where action is the thread's CREATED action, which is null for a pre-existing expense. That is why the opened expense never dims.
The chat preview already works because TransactionPreviewContent.tsx dims from action?.pendingAction, and the destination newIOUAction carries pendingAction: ADD. That path is untouched by this fix.
The desktop Wide RHP receipt pane has its own gap: MoneyRequestReceiptView.tsx in Wide RHP mode returns pendingFields?.[fieldPath] ?? pendingAction, which is undefined for a move (there is no receipt field for a report change), so the receipt column stays full-opacity.
What changes do you think we should make in order to solve the problem?
src/libs/actions/Transaction.ts (getChangeTransactionsReportOnyxData): mark the move itself as pending on each moved transaction. Optimistic data sets pendingFields: {reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}; success data sets pendingFields: {reportID: null}; failure data restores the prior value (transaction.pendingFields?.reportID ?? null). A plain {reportID: UPDATE} object is used, with no snapshot spread: Onyx merge is deep, so unrelated pending fields (for example a merchant edited offline before the move) survive, and a stale snapshot cannot clobber a concurrent offline edit. Onyx merge deletes the key for the null value (verified in the installed react-native-onyx source, which passes {shouldRemoveNestedNulls: true} for merge mode). Every move entry point funnels through this one shared function (Report field, search bulk move, AddExistingExpenseFooter, DynamicIOURequestEditReport, DynamicIOURequestStepUpgrade), so all of them are covered at once, including isUndelete, which reuses the same builder.
src/libs/TransactionUtils/index.ts (getTransactionPendingAction): replace the Object.keys(pendingFields).length > 0 check with Object.values(pendingFields).some(Boolean), so a cleared {reportID: null} entry can never leave a transaction stuck pending. This is defense-in-depth behind the null-merge above, and it matches the existing hasPendingWrite precedent.
src/pages/inbox/report/ReportActionItemContentCreated.tsx + src/components/ReportActionItem/MoneyRequestView.tsx: compute expensePendingAction = action?.pendingAction ?? transaction?.pendingFields?.reportID, pass it to the outer OfflineWithFeedback, and pass hasParentPendingAction={!!expensePendingAction} into MoneyRequestView. The transaction is already subscribed in this component, so this adds no new Onyx subscription. MoneyRequestView gains a new optional hasParentPendingAction prop (defaults to false, so other callers are unaffected); its getPendingFieldAction returns undefined when hasParentPendingAction || !!pendingAction, which stops the Report field from dimming 0.5 inside the already-dimmed outer wrapper (0.25) while every other field sits at 0.5. The prop is forwarded to the narrow inline MoneyRequestReceiptView as hasParentPendingAction || !!pendingAction. pendingAction itself is untouched, so shouldShowPaid and shouldShowConvertedAmount keep their exact behavior.
src/components/ReportActionItem/MoneyRequestReceiptView.tsx: in the Wide RHP branch only, and only when hasParentPendingAction is false, fall back to the move marker: pendingFields?.[fieldPath] ?? pendingAction ?? pendingFields?.reportID. This covers both desktop paths (the single-expense report view and WideRHPReceiptPanel, which passes no hasParentPendingAction). When the parent report itself is pending, hasParentPendingAction is true and the receipt is already dimmed by the parent, so there is no double-dim.
src/pages/inbox/WideRHPReceiptPanel.tsx: pass hasParentPendingAction from the route report's own pending creation state (report?.pendingFields?.createReport ?? report?.pendingFields?.reportName), mirroring exactly the derivation the ReportScreen outer wrapper uses to dim this panel. Without it, moving into a newly created offline report would dim the receipt twice (0.25) — once by the outer wrapper and once by the Change 4 fallback. The narrow derivation is deliberate: the broader report-pending helper also reads addWorkspaceRoom/createChat, which the outer wrapper does not dim on, so using it would under-dim the receipt on a move in those cases.
Safety of the marker: pendingFields.reportID is strictly narrower than top-level pendingAction, so hasUpdatedTotal (which only reads pendingAction and would otherwise treat the moved expense as invalidating a mixed-currency report total) is unaffected, and row selectability is unaffected (isSelectableReportTransaction only excludes pending DELETE and reject errors). No schema change, no new Onyx subscriptions, and the chat preview is untouched.
What alternative solutions did you explore? (Optional)
Setting top-level transaction.pendingAction = UPDATE on every move: rejected. hasUpdatedTotal (src/libs/ReportUtils.ts) treats any transaction with pendingAction on a mixed-currency report as invalidating the report total, and shouldShowPaid / shouldShowConvertedAmount also read pendingAction. Scoping the marker to pendingFields.reportID avoids all of those side effects.
Driving the opened expense only from parentReportAction?.pendingAction: the observation behind it is correct (the thread's parentReportActionID is optimistically rewritten to the destination newIOUAction, which carries pending ADD), but it fixes only the opened expense. The report list row dims from the transaction, not from any action, so the row would stay full-opacity. The transaction marker covers all three surfaces with one mechanism.
Spreading the existing pending fields ({...transaction.pendingFields, reportID: UPDATE}) in the optimistic update: rejected as unnecessary and risky. Onyx merge is deep, so a plain {reportID: UPDATE} already preserves siblings, and spreading a possibly-stale snapshot could clobber a pending field set by a concurrent offline edit.
Marking the whole destination report pending for the move: rejected. It would dim every expense in the report, including ones that were never moved.
A fix that only sets the marker and the outer wrapper, with no parent-pending signal into MoneyRequestView: rejected because it double-dims. MoneyRequestView suppresses per-field wrappers only when transaction.pendingAction is set, and a move marker does not set it, so the Report field would render at 0.25 opacity inside the 0.5 outer wrapper while all other fields sit at 0.5. The hasParentPendingAction prop is what makes the single 0.5 dim hold.
Tests added and run on baseline e91964cb (all passing):
tests/unit/TransactionTest.ts (2 new tests in the changeTransactionsReport describe): a same-currency move sets pendingFields.reportID = UPDATE optimistically while preserving an unrelated pending merchant field and leaving the transaction-level pendingAction untouched, then clears the marker on success while keeping the merchant field; a failed move restores the original report and clears the marker.
tests/unit/TransactionUtilsTest.ts (2 new tests in the getTransactionPendingAction describe): {reportID: UPDATE} surfaces as UPDATE; all-falsy pendingFields ({reportID: null} after a cleared move) returns null. 6/6 tests pass in that describe.
tests/ui/MoneyRequestReportTransactionItemMovePendingTest.tsx (new file, 4 tests): a moved expense dims to 0.5 opacity in the report row while offline; a plain expense does not dim; an expense whose marker was cleared does not dim; the dimmed row still opens the expense. 4/4 pass.
tests/ui/components/MoneyRequestReceiptViewTest.tsx (3 new tests, "wide RHP move pending state"): the receipt pane dims to 0.5 for a moved expense on desktop Wide RHP while offline; it does not dim a second time when hasParentPendingAction is set; it does not dim for a plain expense. 3/3 pass.
tests/ui/MoneyRequestViewTest.tsx (2 new tests, "moved expense pending state"): the Report field is not double-dimmed when the parent already dims the moved expense; it dims exactly once when the parent does not. 2/2 pass.
npm run lint-changed clean; React Compiler compliance check passed; spell check clean (0 issues). Full typecheck could not be run on this machine: the TypeScript compiler process is killed by the kernel before emitting diagnostics in three attempts (full run, single tsconfig.jest.json, and again after freeing ~3.5 GB from stray processes) — a known limitation of this 6 GB VM; no diagnostics were emitted before the process was killed. The changes keep their declared types, add no any and no new type assertions, and the type-aware lint rules pass on all changed files.
Peer review: independent reviewer, PASS 9/10. The reviewer verified the Onyx merge semantics, the subscription, the absence of double-dim in normal paths, both Wide RHP paths, hasUpdatedTotal and selectability unaffected, the marker lifecycle, prop threading, and types, and re-ran lint (24 pre-existing errors, none on the diff). Its two findings are fixed in this proposal: the WideRHPReceiptPanel double-dim corner (change 5 above) and the test gap for the opened view and Wide RHP surfaces (the 5 UI tests above).
Please re-state the problem that we are trying to solve in this issue.
When a user moves an expense to a different report while offline (via the expense's Report field), the moved expense is greyed out in the chat report preview, but inside the destination report's expense list and inside the moved expense details (both narrow layout and Wide RHP), the expense is not greyed out.
What is the root cause of that problem?
In src/libs/actions/Transaction.ts, the getChangeTransactionsReportOnyxData function constructs optimistic Onyx updates when moving transactions between reports.
While it creates a new IOU report action with pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD in REPORT_ACTIONS${targetReportID} (which dims the action preview in chat), it does not set optimistic pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE (or pendingFields: {reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}) on ${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}.
In report expense lists and transaction views (MoneyRequestView.tsx, TransactionListItem.tsx, etc.), the UI determines whether an expense item should be greyed out/dimmed by inspecting transaction.pendingAction or transaction.pendingFields. Because the transaction object itself is not optimistically updated with a pending status in Onyx during changeTransactionsReport, the expense renders as normal (undimmed) inside the report and transaction view until the network reconnects and the backend responds.
What changes do you think we should make in order to solve the problem?
In src/libs/actions/Transaction.ts, inside getChangeTransactionsReportOnyxData:
Push an optimistic update for each moving transaction into optimisticData, successData, and failureData:
This ensures that the transaction itself reflects the pending update state across all report expense list views and detail screens, consistently dimming until the offline action synchronizes with the server.
What specific scenarios should we cover in automated tests to prevent reoccurrence?
Add a unit test in tests/unit/TransactionTest.ts:
Move an expense to another report offline using changeTransactionsReport.
Verify that ${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID} contains pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE and pendingFields.reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE.
Verify that on network success, pendingAction and pendingFields.reportID resolve to null.
Verify that on network failure, reportID, pendingAction, and pendingFields roll back to their original values.
Activity
applause-bot commentedon Nov 24, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/33be3f4369ee52fda595b859e1e741a54a1021939aa5c71d7a231d99dfe2ee0c
expensify-chore-bot commentedon Nov 24, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @dmkt9 (
External)[-]Expense - When expense is moved to a new report offline it's not greyed out in the report[/-][+][$175] Expense - When expense is moved to a new report offline it's not greyed out in the report[/+]expensify-chore-bot commentedon Nov 24, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022125168217177874171
MelvinBot commentedon Nov 24, 2026
Proposal
What is the root cause of that problem?
Pending state is recorded on the report action, but not consistently on the moved expense. A normal same-currency move creates a pending destination IOU action without marking the transaction pending. The destination report row checks the transaction—not that action—so the moved expense remains undimmed offline.
Opening the expense has a related mismatch: its outer pending-state wrapper checks the expense thread’s existing
CREATEDaction, which the move does not mark pending.Confidence: Medium. The code path is verified, including against the reported staging version; browser reproduction was not performed.
Supporting evidence and alternative explanations
changeTransactionsReport: useReportSelectionActions.ts:187–243.pendingActionor nonemptypendingFields: TransactionUtils/index.ts:1322–1327.Challenge: Some cross-currency moves already set transaction pending state, masking the report-row bug. This rules out a universal opacity-rendering failure.
Action-driven previews can dim independently. However, the issue’s wording does not establish whether “report preview” means the individual expense preview or the aggregate report card; that distinction remains unverified.
What changes do you think we should make in order to solve the problem?
pendingFields.reportIDas pending in the shared move update. Clear it on success and restore its previous value on failure, preserving unrelated pending fields.What alternative solutions did you explore? (Optional)
Changing only the report row would leave opened expenses uncovered. Marking the entire destination report pending would also affect expenses that were not moved.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/107823)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
danlopes18-ctrl commentedon Nov 24, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user moves an existing expense to a different report while offline (via the expense's Report field), the moved expense is only greyed out in the chat report preview. Inside the destination report's expense list and when opening the moved expense itself (both in narrow layout and in desktop Wide RHP), the moved expense is rendered at full opacity with no pending state.
What is the root cause of that problem?
getChangeTransactionsReportOnyxData(src/libs/actions/Transaction.ts:1202-1240):pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADDon the optimistic destination IOU report action (newIOUAction,src/libs/actions/Transaction.ts:1185), which is whyTransactionPreviewContentin the report preview dims the card (src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx:263).TRANSACTIONentry itself (src/libs/actions/Transaction.ts:1202-1217),getChangeTransactionsReportOnyxDataonly setspendingAction: UPDATEwhenshouldClearAmountis true (cross-currency moves) and never setspendingFields.reportID.MoneyRequestReportTransactionItemderives row opacity fromgetTransactionPendingAction(transaction)(src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx:179,278), a same-currency moved expense is not dimmed in the opened report.src/pages/inbox/report/ReportActionItemContentCreated.tsx:95, the outer<OfflineWithFeedback>wrapping<MoneyRequestView>only readsaction?.pendingAction(the existing transaction thread'sCREATEDaction, which is not pending for a pre-existing expense).ReportActionItemContentCreatedviaWideRHPReceiptPanel.tsx:98(multi-expense report) andMoneyRequestReportView.tsx:254(single-expense report). Insidesrc/components/ReportActionItem/MoneyRequestReceiptView.tsx:338-349,getPendingFieldActiononly falls back totransaction?.pendingActionwhenisDisplayedInWideRHPis true — never checkingtransaction?.pendingFields?.reportID— so the entire left receipt column stays undimmed on desktop even ifReportActionItemContentCreatedis updated.src/components/ReportActionItem/MoneyRequestView.tsx:413,630,1859,getPendingFieldActiononly suppresses field-level<OfflineWithFeedback>wrappers whentransaction?.pendingActionis set. Simply dimmingReportActionItemContentCreatedontransaction?.pendingFields?.reportIDwithout informingMoneyRequestViewcauses the Report field (line 1859) — and any other offline-edited field or inline narrow receipt — to render nested<OfflineWithFeedback>wrappers and double-dim (0.5 × 0.5).What changes do you think we should make in order to solve the problem?
pendingFields.reportIDinsrc/libs/actions/Transaction.ts(getChangeTransactionsReportOnyxData, lines 1202–1240):optimisticData, mergependingFields: {...transaction.pendingFields, reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}onto each movedTRANSACTIONentry (preserving unrelated pending fields from prior offline edits).successData, clearpendingFields: {reportID: null}.failureData, restorependingFields: {reportID: transaction.pendingFields?.reportID ?? null}.MoneyRequestReportTransactionItem(viagetTransactionPendingAction) to grey out only the moved expense row inside the opened destination report without affecting untouched sibling expenses.getTransactionPendingActionagainst falsypendingFieldsvalues (src/libs/TransactionUtils/index.ts:1322-1328):Object.values(transaction?.pendingFields ?? {}).some(Boolean)instead ofObject.keys(transaction?.pendingFields ?? {}).length > 0(aligning withSearchUIUtils.ts:1573andspendDataSignature.ts:49), ensuring cleared{reportID: null}/undefinedentries can never leave a transaction stuck in a pending state.src/pages/inbox/report/ReportActionItemContentCreated.tsx:94-111andsrc/components/ReportActionItem/MoneyRequestView.tsx:180-220,630,1303):ReportActionItemContentCreated.tsx, computeexpensePendingAction = action?.pendingAction ?? transaction?.pendingFields?.reportID(transactionis already subscribed at line 48, adding zero new Onyx subscriptions), pass it to<OfflineWithFeedback pendingAction={expensePendingAction}>, and passhasParentPendingAction={!!expensePendingAction}to<MoneyRequestView>(mirroring the existinghasParentPendingActionpattern onMoneyRequestReceiptView).MoneyRequestView.tsx, accept optionalhasParentPendingAction = false, returnundefinedfromgetPendingFieldActionwhenhasParentPendingAction || !!pendingActionis true (keepingpendingAction = transaction?.pendingActionuntouched soshouldShowPaidat line 414 andshouldShowConvertedAmountat line 734 keep their exact behavior), and forwardhasParentPendingAction={hasParentPendingAction || !!pendingAction}to the narrow-layout inline<MoneyRequestReceiptView>at line 1303.src/components/ReportActionItem/MoneyRequestReceiptView.tsx:340-349):isDisplayedInWideRHPis true (andhasParentPendingActionis false), returntransaction?.pendingFields?.[fieldPath] ?? pendingAction ?? transaction?.pendingFields?.reportIDfromgetPendingFieldActionso both the receipt image and empty receipt state dim alongside the details pane on desktop without double-dimming when the parent report itself is pending (MoneyRequestReportView.tsx:258) or in narrow layout.tests/unit/TransactionTest.tsto verify same-currency offline moves setpendingFields.reportID = UPDATE(preserving unrelatedpendingFields), clear it on success, and restore the prior value on failure while keeping existing cross-currencyshouldClearAmountbehavior intact.pendingFields.reportID = UPDATEdims inMoneyRequestReportTransactionItem, inReportActionItemContentCreated/MoneyRequestView(without double-dimming the Report field), and inMoneyRequestReceiptViewwhenisDisplayedInWideRHPis true.What alternative solutions did you explore? (Optional)
transaction.pendingAction = UPDATEunconditionally ingetChangeTransactionsReportOnyxData: Avoided becausetransaction.pendingActionhas broader semantic side effects across the app — for example,ReportUtils.hasUpdatedTotal(src/libs/ReportUtils.ts:13118) treats any transaction withpendingActionon a mixed-currency report as invalidating the report total, andMoneyRequestView.tsx:734(shouldShowConvertedAmount) hides valid converted amounts whenpendingActionis set even whenshouldClearAmountis false. Scoping the move marker topendingFields.reportIDavoids all of these regressions while cleanly covering the report row, narrow expense view, and desktop Wide RHP receipt pane.dankezo commentedon Nov 24, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Moving an existing expense to a different report while offline (through the expense's Report field) leaves the moved expense at full opacity in the destination report's expense list and when opening the moved expense itself, on narrow layout and on desktop Wide RHP. Only the chat report preview dims it. The issue expects the moved expense to be greyed out with a pending state in three places: the report preview (already works), the opened destination report's expense list, and when opening the moved expense itself.
What is the root cause of that problem?
The move records pending state on the destination IOU action but never on the transaction itself, so every surface that dims from the transaction sees a clean expense. Verified on baseline
e91964cb:getChangeTransactionsReportOnyxData(src/libs/actions/Transaction.ts) setspendingAction: UPDATEon the TRANSACTION entry only whenshouldClearAmountis true, i.e. cross-currency moves. It never setspendingFields.reportID, so a same-currency move leaves the transaction with no pending marker at all.MoneyRequestReportTransactionItem(src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx) derives row opacity fromgetTransactionPendingAction(transaction), so a same-currency moved expense is not dimmed in the opened report.ReportActionItemContentCreated.tsxwrapsMoneyRequestViewinOfflineWithFeedback pendingAction={action?.pendingAction}, whereactionis the thread's CREATED action, which is null for a pre-existing expense. That is why the opened expense never dims.TransactionPreviewContent.tsxdims fromaction?.pendingAction, and the destinationnewIOUActioncarriespendingAction: ADD. That path is untouched by this fix.MoneyRequestReceiptView.tsxin Wide RHP mode returnspendingFields?.[fieldPath] ?? pendingAction, which is undefined for a move (there is no receipt field for a report change), so the receipt column stays full-opacity.What changes do you think we should make in order to solve the problem?
src/libs/actions/Transaction.ts(getChangeTransactionsReportOnyxData): mark the move itself as pending on each moved transaction. Optimistic data setspendingFields: {reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}; success data setspendingFields: {reportID: null}; failure data restores the prior value (transaction.pendingFields?.reportID ?? null). A plain{reportID: UPDATE}object is used, with no snapshot spread: Onyx merge is deep, so unrelated pending fields (for example a merchant edited offline before the move) survive, and a stale snapshot cannot clobber a concurrent offline edit. Onyx merge deletes the key for the null value (verified in the installedreact-native-onyxsource, which passes{shouldRemoveNestedNulls: true}for merge mode). Every move entry point funnels through this one shared function (Report field, search bulk move, AddExistingExpenseFooter, DynamicIOURequestEditReport, DynamicIOURequestStepUpgrade), so all of them are covered at once, includingisUndelete, which reuses the same builder.src/libs/TransactionUtils/index.ts(getTransactionPendingAction): replace theObject.keys(pendingFields).length > 0check withObject.values(pendingFields).some(Boolean), so a cleared{reportID: null}entry can never leave a transaction stuck pending. This is defense-in-depth behind the null-merge above, and it matches the existinghasPendingWriteprecedent.src/pages/inbox/report/ReportActionItemContentCreated.tsx+src/components/ReportActionItem/MoneyRequestView.tsx: computeexpensePendingAction = action?.pendingAction ?? transaction?.pendingFields?.reportID, pass it to the outerOfflineWithFeedback, and passhasParentPendingAction={!!expensePendingAction}intoMoneyRequestView. The transaction is already subscribed in this component, so this adds no new Onyx subscription.MoneyRequestViewgains a new optionalhasParentPendingActionprop (defaults to false, so other callers are unaffected); itsgetPendingFieldActionreturns undefined whenhasParentPendingAction || !!pendingAction, which stops the Report field from dimming 0.5 inside the already-dimmed outer wrapper (0.25) while every other field sits at 0.5. The prop is forwarded to the narrow inlineMoneyRequestReceiptViewashasParentPendingAction || !!pendingAction.pendingActionitself is untouched, soshouldShowPaidandshouldShowConvertedAmountkeep their exact behavior.src/components/ReportActionItem/MoneyRequestReceiptView.tsx: in the Wide RHP branch only, and only whenhasParentPendingActionis false, fall back to the move marker:pendingFields?.[fieldPath] ?? pendingAction ?? pendingFields?.reportID. This covers both desktop paths (the single-expense report view andWideRHPReceiptPanel, which passes nohasParentPendingAction). When the parent report itself is pending,hasParentPendingActionis true and the receipt is already dimmed by the parent, so there is no double-dim.src/pages/inbox/WideRHPReceiptPanel.tsx: passhasParentPendingActionfrom the route report's own pending creation state (report?.pendingFields?.createReport ?? report?.pendingFields?.reportName), mirroring exactly the derivation theReportScreenouter wrapper uses to dim this panel. Without it, moving into a newly created offline report would dim the receipt twice (0.25) — once by the outer wrapper and once by the Change 4 fallback. The narrow derivation is deliberate: the broader report-pending helper also readsaddWorkspaceRoom/createChat, which the outer wrapper does not dim on, so using it would under-dim the receipt on a move in those cases.Safety of the marker:
pendingFields.reportIDis strictly narrower than top-levelpendingAction, sohasUpdatedTotal(which only readspendingActionand would otherwise treat the moved expense as invalidating a mixed-currency report total) is unaffected, and row selectability is unaffected (isSelectableReportTransactiononly excludes pending DELETE and reject errors). No schema change, no new Onyx subscriptions, and the chat preview is untouched.What alternative solutions did you explore? (Optional)
transaction.pendingAction = UPDATEon every move: rejected.hasUpdatedTotal(src/libs/ReportUtils.ts) treats any transaction withpendingActionon a mixed-currency report as invalidating the report total, andshouldShowPaid/shouldShowConvertedAmountalso readpendingAction. Scoping the marker topendingFields.reportIDavoids all of those side effects.parentReportAction?.pendingAction: the observation behind it is correct (the thread'sparentReportActionIDis optimistically rewritten to the destinationnewIOUAction, which carries pending ADD), but it fixes only the opened expense. The report list row dims from the transaction, not from any action, so the row would stay full-opacity. The transaction marker covers all three surfaces with one mechanism.{...transaction.pendingFields, reportID: UPDATE}) in the optimistic update: rejected as unnecessary and risky. Onyx merge is deep, so a plain{reportID: UPDATE}already preserves siblings, and spreading a possibly-stale snapshot could clobber a pending field set by a concurrent offline edit.MoneyRequestView: rejected because it double-dims.MoneyRequestViewsuppresses per-field wrappers only whentransaction.pendingActionis set, and a move marker does not set it, so the Report field would render at 0.25 opacity inside the 0.5 outer wrapper while all other fields sit at 0.5. ThehasParentPendingActionprop is what makes the single 0.5 dim hold.Tests added and run on baseline
e91964cb(all passing):tests/unit/TransactionTest.ts(2 new tests in thechangeTransactionsReportdescribe): a same-currency move setspendingFields.reportID = UPDATEoptimistically while preserving an unrelated pending merchant field and leaving the transaction-levelpendingActionuntouched, then clears the marker on success while keeping the merchant field; a failed move restores the original report and clears the marker.tests/unit/TransactionUtilsTest.ts(2 new tests in thegetTransactionPendingActiondescribe):{reportID: UPDATE}surfaces as UPDATE; all-falsy pendingFields ({reportID: null}after a cleared move) returns null. 6/6 tests pass in that describe.tests/ui/MoneyRequestReportTransactionItemMovePendingTest.tsx(new file, 4 tests): a moved expense dims to 0.5 opacity in the report row while offline; a plain expense does not dim; an expense whose marker was cleared does not dim; the dimmed row still opens the expense. 4/4 pass.tests/ui/components/MoneyRequestReceiptViewTest.tsx(3 new tests, "wide RHP move pending state"): the receipt pane dims to 0.5 for a moved expense on desktop Wide RHP while offline; it does not dim a second time whenhasParentPendingActionis set; it does not dim for a plain expense. 3/3 pass.tests/ui/MoneyRequestViewTest.tsx(2 new tests, "moved expense pending state"): the Report field is not double-dimmed when the parent already dims the moved expense; it dims exactly once when the parent does not. 2/2 pass.npm run lint-changedclean; React Compiler compliance check passed; spell check clean (0 issues). Fulltypecheckcould not be run on this machine: the TypeScript compiler process is killed by the kernel before emitting diagnostics in three attempts (full run, singletsconfig.jest.json, and again after freeing ~3.5 GB from stray processes) — a known limitation of this 6 GB VM; no diagnostics were emitted before the process was killed. The changes keep their declared types, add noanyand no new type assertions, and the type-aware lint rules pass on all changed files.Peer review: independent reviewer, PASS 9/10. The reviewer verified the Onyx merge semantics, the subscription, the absence of double-dim in normal paths, both Wide RHP paths,
hasUpdatedTotaland selectability unaffected, the marker lifecycle, prop threading, and types, and re-ran lint (24 pre-existing errors, none on the diff). Its two findings are fixed in this proposal: theWideRHPReceiptPaneldouble-dim corner (change 5 above) and the test gap for the opened view and Wide RHP surfaces (the 5 UI tests above).Contributor details
Your Expensify account email: dannyphan190@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~013b564a690d9bcdab
melvin-bot commentedon Nov 24, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
kevinjosh10 commentedon Nov 24, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user moves an expense to a different report while offline (via the expense's Report field), the moved expense is greyed out in the chat report preview, but inside the destination report's expense list and inside the moved expense details (both narrow layout and Wide RHP), the expense is not greyed out.
What is the root cause of that problem?
In
src/libs/actions/Transaction.ts, thegetChangeTransactionsReportOnyxDatafunction constructs optimistic Onyx updates when moving transactions between reports.While it creates a new IOU report action with
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADDinREPORT_ACTIONS${targetReportID}(which dims the action preview in chat), it does not set optimisticpendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE(orpendingFields: {reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}) on${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}.In report expense lists and transaction views (
MoneyRequestView.tsx,TransactionListItem.tsx, etc.), the UI determines whether an expense item should be greyed out/dimmed by inspectingtransaction.pendingActionortransaction.pendingFields. Because the transaction object itself is not optimistically updated with a pending status in Onyx duringchangeTransactionsReport, the expense renders as normal (undimmed) inside the report and transaction view until the network reconnects and the backend responds.What changes do you think we should make in order to solve the problem?
In
src/libs/actions/Transaction.ts, insidegetChangeTransactionsReportOnyxData:Push an optimistic update for each moving transaction into
optimisticData,successData, andfailureData:This ensures that the transaction itself reflects the pending update state across all report expense list views and detail screens, consistently dimming until the offline action synchronizes with the server.
What specific scenarios should we cover in automated tests to prevent reoccurrence?
Add a unit test in
tests/unit/TransactionTest.ts:changeTransactionsReport.${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}containspendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATEandpendingFields.reportID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE.pendingActionandpendingFields.reportIDresolve tonull.reportID,pendingAction, andpendingFieldsroll back to their original values.Contributor details?
dmkt9 commentedon Nov 27, 2026
MelvinBot's proposal looks good to me
🎀 👀 🎀 C+
expensify-chore-bot commentedon Nov 27, 2026
Triggered auto assignment to @JS00001, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
JS00001 commentedon Nov 27, 2026
@dukenv0307 feel free to work through it w/ melvin
dukenv0307 commentedon Nov 27, 2026
@JS00001 you mean @dmkt9 😄?
JS00001 commentedon Nov 30, 2026
lol, yes sorry, @dmkt9 go for it, sorry!!
dmkt9 commentedon Dec 2, 2026
@MelvinBot implement this #107823 (comment)