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
[$250] Expense - Approval modal does not show up, held expense is auto unheld #87223
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
The header primary "Approve" button uses useConfirmApproval which calls hasHeldExpenses(reportID) — a function that relies on a non-reactive module-level global (deprecatedReportsTransactions) populated via Onyx.connect. This global can be stale when the hold was recently applied, causing isAnyTransactionOnHold to be false at render time. The confirmation modal is skipped and approveMoneyRequest is called with full: true, which optimistically clears the hold on all held transactions — auto-unholding them without user confirmation.
The function itself is annotated with a warning: "Use hasHeldExpensesFromTransactions instead." The other two approve paths (ApproveActionButton and useLifecycleActions) already use the reactive useTransactionsAndViolationsForReport hook and pass the result to hasHeldExpensesFromTransactions, so they correctly detect held expenses.
What changes do you think we should make in order to solve the problem?
In useConfirmApproval.ts, switch from the deprecated hasHeldExpenses(reportID) to the reactive pattern used by the other approve paths:
Add useTransactionsAndViolationsForReport(reportID) to fetch transactions reactively.
Replace hasHeldExpenses(moneyRequestReport?.reportID) with hasHeldExpensesFromTransactions(transactions).
This aligns the header approve button with the existing correct implementations in ApproveActionButton and useLifecycleActions.
Investigation details
Three parallel approve paths exist, but only one is buggy:
Entry point
Hold check method
Data source
Reactive?
useConfirmApproval.ts:32 (header button)
hasHeldExpenses(reportID)
deprecatedReportsTransactions global
No
ApproveActionButton.tsx:56 (report preview)
hasHeldExpensesFromTransactions(transactions)
useTransactionsAndViolationsForReport hook
Yes
useLifecycleActions.tsx:128 (secondary menu)
hasHeldExpensesFromTransactions(transactions)
useTransactionsAndViolationsForReport hook
Yes
The deprecated global deprecatedReportsTransactions is populated by an Onyx.connect callback with waitForCollectionCallback: true. Unlike useOnyx hooks, this does not trigger React re-renders when transactions change. When a hold is applied and the user navigates back and clicks Approve before this callback fires, the check misses the held expense.
Possibly related open issues
Expensify/App#89429 — Held Expense with Multiple Violations Is Automatically Unheld and Approved Without Prompt
Expensify/App#88355 — Rejected and Held Expenses Not Handled Correctly During Approval Flow
Expensify/App#87971 — Approval Modal Shows Incorrect Amounts and Inconsistent State for Reports with Held Expenses
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.
changed the title [-]Expense - Approval modal does not show up, held expense is auto unheld[/-][+][$250] Expense - Approval modal does not show up, held expense is auto unheld[/+]on May 11, 2026
Please re-state the problem that we are trying to solve in this issue.
When a user holds an expense on a submitted money-request report and then clicks Approve from the report header, two things go wrong simultaneously: the approval confirmation modal never appears, and the held expense is silently un-held. The expected behavior is that clicking Approve while any transaction is on hold should open the hold-menu modal, which lets the user review and confirm what will happen to held expenses before approval proceeds.
What is the root cause of that problem?
The bug is in src/components/MoneyReportHeaderPrimaryAction/useConfirmApproval.ts at line 31.
hasHeldExpenses in src/libs/ReportUtils.ts (lines 10841–10845) accepts an optional second argument allReportTransactions?: Transaction[]. When that argument is omitted, it falls back to getReportTransactions(iouReportID), which reads from a module-level non-reactive snapshot (deprecatedReportsTransactions). That snapshot is populated at startup and does not update when Onyx writes a hold optimistically. So immediately after the user taps Hold and then taps Approve, the snapshot still reflects the pre-hold state — isAnyTransactionOnHold is false.
Because isAnyTransactionOnHold is false, confirmApproval skips the openHoldMenu branch and falls through to approveMoneyRequest({..., full: true}). Inside approveMoneyRequest, the held status is read via a separate, live Onyx path, so it correctly sees the hold — and wipes the hold reason as part of the full-approval flow. That produces both symptoms: no modal, and the hold disappears.
The correct pattern already exists in the codebase. src/components/MoneyReportHeaderModals.tsx (lines 41–50) uses useTransactionsAndViolationsForReport — a fully reactive hook that subscribes to Onyx — and passes its transactions map to the hold-check utilities. useConfirmApproval needs to do the same.
Note: hasHeldExpenses carries an in-source @warning directing callers to prefer hasHeldExpensesFromTransactions (src/libs/ReportUtils.ts, lines 10850–10852), which takes a required Transaction[] and has no stale-snapshot fallback. The fix targets that preferred API directly.
What changes do you think we should make in order to solve the problem?
Import useTransactionsAndViolationsForReport from @hooks/useTransactionsAndViolationsForReport.
Import hasHeldExpensesFromTransactions (the preferred, snapshot-free variant) from @libs/ReportUtils alongside the existing hasHeldExpenses import.
Call the hook and derive a Transaction[] from the reactive map it returns. Guard against the case where the hook returns no transactions (e.g. the report has not loaded yet) by defaulting to an empty array — hasHeldExpensesFromTransactions([]) correctly returns false, which is safe: if there are no transactions loaded, there is nothing to hold-check against and approval proceeds normally.
Replace the stale-snapshot call with the reactive one.
Inside the hook body, after the existing useOnyx calls:
// Before (line 31) — reads from stale non-reactive snapshot:// const isAnyTransactionOnHold = hasHeldExpensesReportUtils(moneyRequestReport?.reportID);// After — reactive, always reflects current Onyx state:const{transactions: transactionsForReport}=useTransactionsAndViolationsForReport(moneyRequestReport?.reportID);consttransactionsArray=Object.values(transactionsForReport??{});constisAnyTransactionOnHold=hasHeldExpensesReportUtilsFromTransactions(transactionsArray);
useTransactionsAndViolationsForReport returns {transactions, violations} where transactions is a Record<string, Transaction> keyed by the full Onyx key. Object.values(transactionsForReport ?? {}) converts it to Transaction[] safely — when the report has no transactions or has not loaded yet, it produces [] and hasHeldExpensesFromTransactions returns false, which is the correct safe default (no hold check fires for an empty report).
No other files need changes. The rest of confirmApproval — the openHoldMenu call, the approveMoneyRequest call, and the delegate-access guard — is correct as written.
What alternative solutions did you explore?
Pass reportID + the optional second argument to the existing hasHeldExpenses. hasHeldExpenses does accept allReportTransactions?: Transaction[] as a second argument, so it could be called as hasHeldExpenses(reportID, transactionsArray). This works, but hasHeldExpenses carries an explicit @warning in its JSDoc saying callers should use hasHeldExpensesFromTransactions instead. Calling the preferred function directly is cleaner and removes any ambiguity about which code path executes.
Subscribe to ONYXKEYS.COLLECTION.TRANSACTION directly via useOnyx.
Adding a useOnyx call for the full transaction collection would give reactive data, but it would subscribe to all transactions across all reports — a much broader Onyx subscription than needed. useTransactionsAndViolationsForReport already scopes the subscription to the specific report, so it is strictly preferable.
Read transactions inside confirmApproval at call time.
Calling getReportTransactions inside the confirmApproval callback (at click time rather than at render time) would pick up the latest snapshot value. However, the snapshot is module-level and not guaranteed to be flushed by the time the click handler fires; this is the same underlying fragility. React state derived from a hook is the idiomatic and reliable solution.
Please re-state the problem that we are trying to solve in this issue
When a user holds an expense on a submitted money-request report and then clicks Approve from the report header, the approval confirmation modal does not appear and the held expense is silently un-held. The expected behavior is that the hold menu modal appears, letting the user confirm what happens to held expenses before proceeding.
What is the root cause of that problem?
The primary root cause — useConfirmApproval.ts calling the deprecated hasHeldExpenses(reportID) which reads from the non-reactive deprecatedReportsTransactions module-level global — has already been fixed on main. The hook now uses useTransactionsAndViolationsForReport + hasHeldExpensesFromTransactions, which is reactive and correctly triggers re-renders when hold state changes. ✅
However, there is a remaining stale-data path in approveMoneyRequest (src/libs/actions/IOU/ReportWorkflow.ts) that has not been addressed:
While hasHeldExpenses and hasHeldExpensesFromTransactions have identical implementations when called with a Transaction[] argument (both just call .some(t => isOnHold(t)) on the array), hasHeldExpenses carries an explicit @warning to prefer the named variant. More importantly, getReportTransactions on line 377 resolves through the same deprecatedReportsTransactions global, meaning reportTransactions itself may be stale.
When useConfirmApproval now correctly opens the hold menu and the user confirms, approveMoneyRequest is called with full: true. Inside that function, the hasHeldExpenses determination at line 379 comes from the stale global. If the global is stale (which is less likely in this specific flow since the user just interacted with the modal, but possible in edge cases like rapid network changes), the hold-clearing logic at lines 617–629 would be skipped. Conversely, if the global IS current, it works — but this is by accident, not by design.
The same pattern exists in two sibling action functions:
What changes do you think we should make in order to solve the problem?
Change 1 — src/libs/actions/IOU/ReportWorkflow.ts line 35:
Replace the deprecated import with the preferred variant:
-import {hasHeldExpenses as hasHeldExpensesReportUtils, …} from @libs/ReportUtils;+import {hasHeldExpensesFromTransactions as hasHeldExpensesReportUtils, …} from @libs/ReportUtils;
This is a safe drop-in replacement because both functions accept Transaction[] and have identical behavior when called with a populated array. The only reason hasHeldExpenses exists separately is its deprecated overload that accepts a reportID string and reads from the global — but that overload is never triggered when a populated array is passed. Using hasHeldExpensesFromTransactions follows the explicit @warning in the codebase and makes the intent clear: we are intentionally passing pre-fetched transaction data, not relying on a global cache.
Change 2 — Consistency: apply the same swap in sibling functions.
The same import swap should be applied wherever hasHeldExpenses is imported in ReportWorkflow.ts for the same pattern (calling with getReportTransactions result). This ensures all three action functions (approveMoneyRequest, submitMoneyRequest, payMoneyRequest) consistently use the non-deprecated variant.
Change 3 (already on main) — useConfirmApproval.ts:
The switch to useTransactionsAndViolationsForReport + hasHeldExpensesFromTransactions is already in place on the main branch. This resolved the modal-not-showing symptom. No further changes needed here.
Overall impact: After these changes, the only remaining callers of the deprecated hasHeldExpenses (the string-ID overload) will be in ReportUtils.ts internal functions like hasOptimisticHeldExpense (line 10872) and hasReportHeldExpense (line 10898) — these are utility functions that intentionally read from the global and are not involved in the approval flow. The deprecated overload path will no longer be reachable from any approval or hold-flow call site.
What alternative solutions did you explore? (Optional)
Pass reactive transactions from useConfirmApproval into approveMoneyRequest via an iouTransactions parameter.approveMoneyRequest already has an optional iouTransactions parameter used by submitMoneyRequest. Extending it would ensure the caller's reactive data flows through, but it requires updating all callers and the function signature — the import swap achieves the same consistency goal with minimal diff size.
Remove getReportTransactions calls inside approveMoneyRequest and require callers to pass transactions. This is the cleanest long-term fix but is a larger refactor. The import swap is the minimal safe change that eliminates the deprecated function from the approval flow without breaking existing callers.
Add a useOnyx subscription for ONYXKEYS.COLLECTION.TRANSACTION with a selector inside useConfirmApproval (as proposed by @Hossiy21). This is a valid alternative approach for the useConfirmApproval path, but it does not address the ReportWorkflow.ts action-function path, which cannot use hooks. The reactive-hook fix is already on main, and the import swap in ReportWorkflow.ts is the complementary action-function fix.
📣 @nguyenlnp! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
The fix from my proposal has already been merged to main. The file useConfirmApproval.ts now uses the reactive useTransactionsAndViolationsForReport hook and hasHeldExpensesFromTransactions, which is exactly what my proposal recommended. There is no draft PR to create — the primary fix is already shipped.
Proposal Summary & Review
All proposals except one identify the same root cause and recommend the same fix. Here's a comparison:
Switch to useTransactionsAndViolationsForReport + hasHeldExpensesFromTransactions
✅ Already merged
2
aswin-s
Same as above
Same fix + mentions edge-case guards
✅ Correct, already merged
3
wildan-m
Same as above
Same fix (includes compare branch)
✅ Correct, already merged
4
Hossiy21
Same as above
Same fix
✅ Correct, already merged
5
Abdulloh0109
Same as above
Same fix
✅ Correct, already merged
6
nguyenlnp
Acknowledges primary fix is merged; flags remaining stale paths in ReportWorkflow.ts
Replace getReportTransactions + hasHeldExpenses calls in action functions
⚠️ Different scope — see below
Detailed Review
Proposals 1–5 (MelvinBot, aswin-s, wildan-m, Hossiy21, Abdulloh0109): All correctly identified the non-reactive deprecatedReportsTransactions global as the root cause and proposed the same reactive hook fix. The fix is already on main. These proposals are all substantively identical. wildan-m provided a compare branch which is a nice touch, and aswin-s mentioned additional edge-case guards, but the core fix is the same across all five.
Proposal 6 (nguyenlnp): This is the only proposal that acknowledges the primary fix is already merged and instead focuses on remaining stale-data paths in src/libs/actions/IOU/ReportWorkflow.ts. Specifically, approveMoneyRequest (line 381), submitMoneyRequest (line 138), and payMoneyRequest (line 297) still call getReportTransactions() which reads from the same deprecated global. However, these are action functions (not React hooks), so they run imperatively at call time rather than at render time. The staleness risk is lower here because the global is typically up-to-date by the time a user clicks through a modal confirmation. This proposal addresses a valid code-quality concern (using deprecated APIs) but is less clearly a fix for the reported bug.
Recommendation
Since the primary fix is already merged, the issue may be ready to close pending QA verification. If there's interest in the cleanup nguyenlnp identified in ReportWorkflow.ts, that could be tracked as a separate follow-up task.
Next Steps: Reply with @MelvinBot <your feedback> if you need anything else.
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Activity
MelvinBot commentedon May 11, 2026
Proposal
What is the root cause of that problem?
The header primary "Approve" button uses
useConfirmApprovalwhich callshasHeldExpenses(reportID)— a function that relies on a non-reactive module-level global (deprecatedReportsTransactions) populated viaOnyx.connect. This global can be stale when the hold was recently applied, causingisAnyTransactionOnHoldto befalseat render time. The confirmation modal is skipped andapproveMoneyRequestis called withfull: true, which optimistically clears the hold on all held transactions — auto-unholding them without user confirmation.The function itself is annotated with a warning: "Use
hasHeldExpensesFromTransactionsinstead." The other two approve paths (ApproveActionButtonanduseLifecycleActions) already use the reactiveuseTransactionsAndViolationsForReporthook and pass the result tohasHeldExpensesFromTransactions, so they correctly detect held expenses.What changes do you think we should make in order to solve the problem?
In
useConfirmApproval.ts, switch from the deprecatedhasHeldExpenses(reportID)to the reactive pattern used by the other approve paths:useTransactionsAndViolationsForReport(reportID)to fetch transactions reactively.hasHeldExpenses(moneyRequestReport?.reportID)withhasHeldExpensesFromTransactions(transactions).This aligns the header approve button with the existing correct implementations in
ApproveActionButtonanduseLifecycleActions.Investigation details
Three parallel approve paths exist, but only one is buggy:
useConfirmApproval.ts:32(header button)hasHeldExpenses(reportID)deprecatedReportsTransactionsglobalApproveActionButton.tsx:56(report preview)hasHeldExpensesFromTransactions(transactions)useTransactionsAndViolationsForReporthookuseLifecycleActions.tsx:128(secondary menu)hasHeldExpensesFromTransactions(transactions)useTransactionsAndViolationsForReporthookThe deprecated global
deprecatedReportsTransactionsis populated by anOnyx.connectcallback withwaitForCollectionCallback: true. UnlikeuseOnyxhooks, this does not trigger React re-renders when transactions change. When a hold is applied and the user navigates back and clicks Approve before this callback fires, the check misses the held expense.Possibly related open issues
Next 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.melvin-bot commentedon May 11, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ChavdaSachin (
External)[-]Expense - Approval modal does not show up, held expense is auto unheld[/-][+][$250] Expense - Approval modal does not show up, held expense is auto unheld[/+]melvin-bot commentedon May 11, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022053919194836242151
aswin-s commentedon May 11, 2026
Please re-state the problem that we are trying to solve in this issue.
When a user holds an expense on a submitted money-request report and then clicks Approve from the report header, two things go wrong simultaneously: the approval confirmation modal never appears, and the held expense is silently un-held. The expected behavior is that clicking Approve while any transaction is on hold should open the hold-menu modal, which lets the user review and confirm what will happen to held expenses before approval proceeds.
What is the root cause of that problem?
The bug is in
src/components/MoneyReportHeaderPrimaryAction/useConfirmApproval.tsat line 31.App/src/components/MoneyReportHeaderPrimaryAction/useConfirmApproval.ts
Line 31 in 3512d3d
The line reads:
hasHeldExpensesinsrc/libs/ReportUtils.ts(lines 10841–10845) accepts an optional second argumentallReportTransactions?: Transaction[]. When that argument is omitted, it falls back togetReportTransactions(iouReportID), which reads from a module-level non-reactive snapshot (deprecatedReportsTransactions). That snapshot is populated at startup and does not update when Onyx writes a hold optimistically. So immediately after the user taps Hold and then taps Approve, the snapshot still reflects the pre-hold state —isAnyTransactionOnHoldisfalse.Because
isAnyTransactionOnHoldisfalse,confirmApprovalskips theopenHoldMenubranch and falls through toapproveMoneyRequest({..., full: true}). InsideapproveMoneyRequest, the held status is read via a separate, live Onyx path, so it correctly sees the hold — and wipes the hold reason as part of the full-approval flow. That produces both symptoms: no modal, and the hold disappears.The correct pattern already exists in the codebase.
src/components/MoneyReportHeaderModals.tsx(lines 41–50) usesuseTransactionsAndViolationsForReport— a fully reactive hook that subscribes to Onyx — and passes itstransactionsmap to the hold-check utilities.useConfirmApprovalneeds to do the same.Note:
hasHeldExpensescarries an in-source@warningdirecting callers to preferhasHeldExpensesFromTransactions(src/libs/ReportUtils.ts, lines 10850–10852), which takes a requiredTransaction[]and has no stale-snapshot fallback. The fix targets that preferred API directly.What changes do you think we should make in order to solve the problem?
File:
src/components/MoneyReportHeaderPrimaryAction/useConfirmApproval.tsuseTransactionsAndViolationsForReportfrom@hooks/useTransactionsAndViolationsForReport.hasHeldExpensesFromTransactions(the preferred, snapshot-free variant) from@libs/ReportUtilsalongside the existinghasHeldExpensesimport.Transaction[]from the reactive map it returns. Guard against the case where the hook returns no transactions (e.g. the report has not loaded yet) by defaulting to an empty array —hasHeldExpensesFromTransactions([])correctly returnsfalse, which is safe: if there are no transactions loaded, there is nothing to hold-check against and approval proceeds normally.Inside the hook body, after the existing
useOnyxcalls:useTransactionsAndViolationsForReportreturns{transactions, violations}wheretransactionsis aRecord<string, Transaction>keyed by the full Onyx key.Object.values(transactionsForReport ?? {})converts it toTransaction[]safely — when the report has no transactions or has not loaded yet, it produces[]andhasHeldExpensesFromTransactionsreturnsfalse, which is the correct safe default (no hold check fires for an empty report).No other files need changes. The rest of
confirmApproval— theopenHoldMenucall, theapproveMoneyRequestcall, and the delegate-access guard — is correct as written.What alternative solutions did you explore?
Pass
reportID+ the optional second argument to the existinghasHeldExpenses.hasHeldExpensesdoes acceptallReportTransactions?: Transaction[]as a second argument, so it could be called ashasHeldExpenses(reportID, transactionsArray). This works, buthasHeldExpensescarries an explicit@warningin its JSDoc saying callers should usehasHeldExpensesFromTransactionsinstead. Calling the preferred function directly is cleaner and removes any ambiguity about which code path executes.Subscribe to
ONYXKEYS.COLLECTION.TRANSACTIONdirectly viauseOnyx.Adding a
useOnyxcall for the full transaction collection would give reactive data, but it would subscribe to all transactions across all reports — a much broader Onyx subscription than needed.useTransactionsAndViolationsForReportalready scopes the subscription to the specific report, so it is strictly preferable.Read transactions inside
confirmApprovalat call time.Calling
getReportTransactionsinside theconfirmApprovalcallback (at click time rather than at render time) would pick up the latest snapshot value. However, the snapshot is module-level and not guaranteed to be flushed by the time the click handler fires; this is the same underlying fragility. React state derived from a hook is the idiomatic and reliable solution.12 remaining items
nguyenlnp commentedon May 21, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue
When a user holds an expense on a submitted money-request report and then clicks Approve from the report header, the approval confirmation modal does not appear and the held expense is silently un-held. The expected behavior is that the hold menu modal appears, letting the user confirm what happens to held expenses before proceeding.
What is the root cause of that problem?
The primary root cause —
useConfirmApproval.tscalling the deprecatedhasHeldExpenses(reportID)which reads from the non-reactivedeprecatedReportsTransactionsmodule-level global — has already been fixed onmain. The hook now usesuseTransactionsAndViolationsForReport+hasHeldExpensesFromTransactions, which is reactive and correctly triggers re-renders when hold state changes. ✅However, there is a remaining stale-data path in
approveMoneyRequest(src/libs/actions/IOU/ReportWorkflow.ts) that has not been addressed:At line 377,
approveMoneyRequestcalls:and at line 379:
The import at line 35 is:
While
hasHeldExpensesandhasHeldExpensesFromTransactionshave identical implementations when called with aTransaction[]argument (both just call.some(t => isOnHold(t))on the array),hasHeldExpensescarries an explicit@warningto prefer the named variant. More importantly,getReportTransactionson line 377 resolves through the samedeprecatedReportsTransactionsglobal, meaningreportTransactionsitself may be stale.When
useConfirmApprovalnow correctly opens the hold menu and the user confirms,approveMoneyRequestis called withfull: true. Inside that function, thehasHeldExpensesdetermination at line 379 comes from the stale global. If the global is stale (which is less likely in this specific flow since the user just interacted with the modal, but possible in edge cases like rapid network changes), the hold-clearing logic at lines 617–629 would be skipped. Conversely, if the global IS current, it works — but this is by accident, not by design.The same pattern exists in two sibling action functions:
submitMoneyRequest(line 138):const reportTransactions = iouTransactions ?? getReportTransactions(iouReport?.reportID);payMoneyRequest(line 293):getReportTransactions(iouReport?.reportID)What changes do you think we should make in order to solve the problem?
Change 1 —
src/libs/actions/IOU/ReportWorkflow.tsline 35:Replace the deprecated import with the preferred variant:
This is a safe drop-in replacement because both functions accept
Transaction[]and have identical behavior when called with a populated array. The only reasonhasHeldExpensesexists separately is its deprecated overload that accepts areportIDstring and reads from the global — but that overload is never triggered when a populated array is passed. UsinghasHeldExpensesFromTransactionsfollows the explicit@warningin the codebase and makes the intent clear: we are intentionally passing pre-fetched transaction data, not relying on a global cache.Change 2 — Consistency: apply the same swap in sibling functions.
The same import swap should be applied wherever
hasHeldExpensesis imported inReportWorkflow.tsfor the same pattern (calling withgetReportTransactionsresult). This ensures all three action functions (approveMoneyRequest,submitMoneyRequest,payMoneyRequest) consistently use the non-deprecated variant.Change 3 (already on main) —
useConfirmApproval.ts:The switch to
useTransactionsAndViolationsForReport+hasHeldExpensesFromTransactionsis already in place on themainbranch. This resolved the modal-not-showing symptom. No further changes needed here.Overall impact: After these changes, the only remaining callers of the deprecated
hasHeldExpenses(the string-ID overload) will be inReportUtils.tsinternal functions likehasOptimisticHeldExpense(line 10872) andhasReportHeldExpense(line 10898) — these are utility functions that intentionally read from the global and are not involved in the approval flow. The deprecated overload path will no longer be reachable from any approval or hold-flow call site.What alternative solutions did you explore? (Optional)
Pass reactive transactions from
useConfirmApprovalintoapproveMoneyRequestvia aniouTransactionsparameter.approveMoneyRequestalready has an optionaliouTransactionsparameter used bysubmitMoneyRequest. Extending it would ensure the caller's reactive data flows through, but it requires updating all callers and the function signature — the import swap achieves the same consistency goal with minimal diff size.Remove
getReportTransactionscalls insideapproveMoneyRequestand require callers to pass transactions. This is the cleanest long-term fix but is a larger refactor. The import swap is the minimal safe change that eliminates the deprecated function from the approval flow without breaking existing callers.Add a
useOnyxsubscription forONYXKEYS.COLLECTION.TRANSACTIONwith a selector insideuseConfirmApproval(as proposed by @Hossiy21). This is a valid alternative approach for theuseConfirmApprovalpath, but it does not address theReportWorkflow.tsaction-function path, which cannot use hooks. The reactive-hook fix is already on main, and the import swap inReportWorkflow.tsis the complementary action-function fix.melvin-bot commentedon May 21, 2026
📣 @nguyenlnp! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
nguyenlnp commentedon May 21, 2026
Contributor details
Your Expensify account email: contact@nguyenlnp.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01a8d28742cf532153
melvin-bot commentedon May 21, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
melvin-bot commentedon May 22, 2026
@ChavdaSachin 10 days overdue. Is anyone even seeing these? Hello?
ChavdaSachin commentedon May 25, 2026
@MelvinBot, please create a draft from your proposal, and also summarize and review all the available proposals.
MelvinBot commentedon May 25, 2026
Draft PR Status
The fix from my proposal has already been merged to
main. The fileuseConfirmApproval.tsnow uses the reactiveuseTransactionsAndViolationsForReporthook andhasHeldExpensesFromTransactions, which is exactly what my proposal recommended. There is no draft PR to create — the primary fix is already shipped.Proposal Summary & Review
All proposals except one identify the same root cause and recommend the same fix. Here's a comparison:
useConfirmApprovaluses deprecated non-reactivehasHeldExpenses(reportID)useTransactionsAndViolationsForReport+hasHeldExpensesFromTransactionsaswin-swildan-mHossiy21Abdulloh0109nguyenlnpReportWorkflow.tsgetReportTransactions+hasHeldExpensescalls in action functionsDetailed Review
Proposals 1–5 (MelvinBot,
aswin-s,wildan-m,Hossiy21,Abdulloh0109): All correctly identified the non-reactivedeprecatedReportsTransactionsglobal as the root cause and proposed the same reactive hook fix. The fix is already onmain. These proposals are all substantively identical.wildan-mprovided a compare branch which is a nice touch, andaswin-smentioned additional edge-case guards, but the core fix is the same across all five.Proposal 6 (
nguyenlnp): This is the only proposal that acknowledges the primary fix is already merged and instead focuses on remaining stale-data paths insrc/libs/actions/IOU/ReportWorkflow.ts. Specifically,approveMoneyRequest(line 381),submitMoneyRequest(line 138), andpayMoneyRequest(line 297) still callgetReportTransactions()which reads from the same deprecated global. However, these are action functions (not React hooks), so they run imperatively at call time rather than at render time. The staleness risk is lower here because the global is typically up-to-date by the time a user clicks through a modal confirmation. This proposal addresses a valid code-quality concern (using deprecated APIs) but is less clearly a fix for the reported bug.Recommendation
Since the primary fix is already merged, the issue may be ready to close pending QA verification. If there's interest in the cleanup
nguyenlnpidentified inReportWorkflow.ts, that could be tracked as a separate follow-up task.Next Steps: Reply with
@MelvinBot <your feedback>if you need anything else.ChavdaSachin commentedon May 25, 2026
🎀 👀 🎀 C+ reviewed
Issue no longer reproducible; already fixed elsewhere.
please close this.
melvin-bot commentedon May 25, 2026
Triggered auto assignment to @marcaaron, see https://stackoverflow.com/c/expensify/questions/7972 for more details.