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] Hold - Approve modal displays same amount full report and pending expense #102333
The Approve options get both amounts from report-level totals that the server sends. They don't use the report's transactions. getNonHeldAndFullAmount reads:
"Approve only X" from report.unheldTotal
"Approve Y" from reimbursableTotal + nonReimbursableTotal
The employee who places the hold gets updated unheldTotal values right away, from optimistic data in putOnHold. The approver doesn't. The approver does receive the transaction's hold, which is why the "Approve only" option appears. But their copy of the report still has unheldTotal equal to the full total, so both options show the same amount.
What changes do you think we should make in order to solve the problem?
In getNonHeldAndFullAmount, calculate the held amount from allReportTransactions. Every caller already passes these, and the approver has them.
Add up the amounts of held transactions in the report currency. Convert when a transaction's currency differs from the report's.
For the pay branch, count only reimbursable held transactions.
Set the non-held amount to the full total minus the held amount.
Use the same helper for the partial approve and partial pay amounts, so the amount shown matches the amount submitted.
Add a unit test. Use a report whose unheldTotal equals total and one held transaction, and check that the non-held amount excludes the held transaction.
Separately, an internal engineer should check whether the backend sends updated unheld totals to other report participants after a hold.
What alternative solutions did you explore? (Optional)
Keep the report fields, but switch to the transaction-based amount only when a held expense exists and unheldTotal equals the total. This change is smaller, but it misses cases where the report fields are only partly stale.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/102333) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
changed the title [-]Hold - Approve modal displays same amount full report and pending expense[/-][+][$175] Hold - Approve modal displays same amount full report and pending expense[/+]on Sep 25, 2026
When a user puts an expense on hold, the hold status is immediately saved on the transaction object (transaction.comment.hold = true).
In ExpenseHeaderApprovalButton.tsx, allReportTransactions is passed into getNonHeldAndFullAmount. hasHeldExpenses(allReportTransactions) detects the hold and causes the dropdown menu to appear.
However, getNonHeldAndFullAmount computes unheldTotal strictly from iouReport?.unheldTotal or iouReport?.unheldReimbursableTotal. Because iouReport stored totals in Onyx are not yet updated with the new unheld split until the report re-computes on the backend, iouReport?.unheldTotal remains undefined or equal to the full total.
As a result, unheldTotal defaults to the full report total, causing both dropdown options ("Approve only <amount>" and "Approve <amount>") in getApprovalDropdownOptions to display the identical full report amount.
What changes do you think we should make in order to solve the problem?
In src/libs/ReportUtils.ts inside getNonHeldAndFullAmount:
When allReportTransactions contains held expenses, compute the unheld amounts directly from allReportTransactions (filtering transactions where !isHold(transaction)) as an optimistic fallback when iouReport?.unheldTotal is missing or equal to the full total:
Calculate unheldTransactionTotal from allReportTransactions.filter(t => !isHold(t)) (separating reimbursable vs non-reimbursable amounts).
Use this derived amount for unheldTotal and unheldReimbursableTotal when report-level unheld fields have not yet synced from the backend.
This ensures the partial approval dropdown immediately displays the true pending (non-held) amount in sync with the user's optimistic hold actions.
What alternative solutions did you explore? (Optional)
We could also update iouReport.unheldTotal optimistically in the putOnHold action, but calculating the client fallback inside getNonHeldAndFullAmount using the already-provided allReportTransactions is cleaner, self-contained, and guarantees accurate display across all report types and viewers.
Test Plan:
As an employee, submit two expenses (e.g. $50 and $50) in a workspace report.
Open one of the expenses and put it on Hold.
As an approver, navigate to the report and click on the "Approve" button.
Verify the dropdown displays:
"Approve only $50" (for the unheld pending expense).
"Approve $100" (for the full report total).
Confirm clicking "Approve only" approves only the non-held amount.
getNonHeldAndFullAmount builds the Approve dropdown amounts from report-level unheld* totals.
The problem is that after an expense is put on hold, the approver can already receive the held state on the transaction, so the partial-approve option appears, while their copy of the report may still have stale unheldTotal / unheldReimbursableTotal values equal to the full total.
That makes both options display the same amount.
The same stale report fields are also used by the partial approve/pay paths, so this can affect not only the label shown to the user, but also the optimistic amount submitted.
What changes do you think we should make in order to solve the problem?
Keep preferring backend-computed unheld* fields when they are consistent, but add a fallback when held transactions prove those fields are stale.
Instead of summing unheld transactions, derive the non-held amount as:
full report total - sum(held transaction amounts in report currency)
This is safer because some callers may have only a partial transaction list; summing the visible unheld transactions could therefore undercount the real pending amount.
I would:
Add a small shared numeric helper near getNonHeldAndFullAmount.
Use the transaction-derived fallback only when:
held transactions exist, and
the report-level unheld value is missing or still equal to the full total.
For held transactions:
use the report-currency amount / converted amount when needed;
for the Pay branch, subtract only reimbursable held transactions.
Reuse the same helper in:
getNonHeldAndFullAmount
the partial approve path in ReportWorkflow
the partial pay path in PayMoneyRequest
This keeps the displayed amount and submitted amount consistent without broadly replacing the backend totals logic.
What alternative solutions did you explore?
Always recalculating the unheld amount from all unheld transactions would be broader and can be incorrect when a caller has an incomplete transaction list.
Updating only the optimistic unheld* fields in putOnHold also would not fully solve this case, because that optimistic update runs on the client that places the hold, not necessarily on the approver's client.
Test Plan
Add focused unit coverage for:
Stale approver case: unheldTotal === fullTotal with one held and one unheld transaction → partial amount excludes the held expense.
Backend already correct: existing reduced unheldTotal is preserved.
Reimbursable vs non-reimbursable held transactions for the Pay path.
Mixed-currency held transaction using its report-currency converted amount.
All-held case keeps the partial option suppressed.
Also verify that the same calculated partial amount is used by the approve/pay submission paths.
Manual repro:
Employee submits two expenses and holds one.
Approver opens the Approve menu.
"Approve only X" shows the non-held amount and differs from "Approve Y".
Choosing the partial action submits that same amount.
Activity
applause-bot commentedon Sep 25, 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/4e847f2a253fb9b17e2fbe16d41937da05e410a7b1c85c855da85848d72bb5e6
MelvinBot commentedon Sep 25, 2026
Proposal
What is the root cause of that problem?
The Approve options get both amounts from report-level totals that the server sends. They don't use the report's transactions.
getNonHeldAndFullAmountreads:report.unheldTotalreimbursableTotal + nonReimbursableTotalThe transactions are used for only one thing: to check whether any expense is held.
The employee who places the hold gets updated
unheldTotalvalues right away, from optimistic data inputOnHold. The approver doesn't. The approver does receive the transaction's hold, which is why the "Approve only" option appears. But their copy of the report still hasunheldTotalequal to the full total, so both options show the same amount.Supporting details
ExpenseHeaderApprovalButton.tsx:86) and the Spend > Reports hold modal (ExpenseReportListItem.tsx:276-299).unheldReimbursableTotalin the same function.ReportWorkflow.ts:514-520,PayMoneyRequest.ts:260-262). If those fields are stale, the optimistic amount is wrong too.What changes do you think we should make in order to solve the problem?
In
getNonHeldAndFullAmount, calculate the held amount fromallReportTransactions. Every caller already passes these, and the approver has them.unheldTotalequalstotaland one held transaction, and check that the non-held amount excludes the held transaction.Separately, an internal engineer should check whether the backend sends updated unheld totals to other report participants after a hold.
What alternative solutions did you explore? (Optional)
Keep the report fields, but switch to the transaction-based amount only when a held expense exists and
unheldTotalequals the total. This change is smaller, but it misses cases where the report fields are only partly stale.Possibly related: Spend - Approve modal inconsistency when approved form Spend and report. It involves the same approve-with-hold amounts, but a different trigger ($0 held expense).
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/102333)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Sep 25, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk (
External)[-]Hold - Approve modal displays same amount full report and pending expense[/-][+][$175] Hold - Approve modal displays same amount full report and pending expense[/+]melvin-bot commentedon Sep 25, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022103555129237584541
ashusatyarthi-wq commentedon Sep 25, 2026
Proposal
What is the root cause of that problem?
In
src/libs/ReportUtils.tswithingetNonHeldAndFullAmount:transaction.comment.hold = true).ExpenseHeaderApprovalButton.tsx,allReportTransactionsis passed intogetNonHeldAndFullAmount.hasHeldExpenses(allReportTransactions)detects the hold and causes the dropdown menu to appear.getNonHeldAndFullAmountcomputesunheldTotalstrictly fromiouReport?.unheldTotaloriouReport?.unheldReimbursableTotal. BecauseiouReportstored totals in Onyx are not yet updated with the new unheld split until the report re-computes on the backend,iouReport?.unheldTotalremains undefined or equal to the full total.unheldTotaldefaults to the full report total, causing both dropdown options ("Approve only <amount>"and"Approve <amount>") ingetApprovalDropdownOptionsto display the identical full report amount.What changes do you think we should make in order to solve the problem?
In
src/libs/ReportUtils.tsinsidegetNonHeldAndFullAmount:When
allReportTransactionscontains held expenses, compute the unheld amounts directly fromallReportTransactions(filtering transactions where!isHold(transaction)) as an optimistic fallback wheniouReport?.unheldTotalis missing or equal to the full total:unheldTransactionTotalfromallReportTransactions.filter(t => !isHold(t))(separating reimbursable vs non-reimbursable amounts).unheldTotalandunheldReimbursableTotalwhen report-level unheld fields have not yet synced from the backend.This ensures the partial approval dropdown immediately displays the true pending (non-held) amount in sync with the user's optimistic hold actions.
What alternative solutions did you explore? (Optional)
We could also update
iouReport.unheldTotaloptimistically in theputOnHoldaction, but calculating the client fallback insidegetNonHeldAndFullAmountusing the already-providedallReportTransactionsis cleaner, self-contained, and guarantees accurate display across all report types and viewers.Test Plan:
ashusatyarthi-wq commentedon Sep 25, 2026
Contributor details
Your Expensify account email: ashusatyarthi@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~010e53044b5828fe60
melvin-bot commentedon Sep 25, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
fix: derive unheld amount from transactions when report unheld total …
hgreco85 commentedon Sep 28, 2026
Proposal
What is the root cause of that problem?
getNonHeldAndFullAmountbuilds the Approve dropdown amounts from report-levelunheld*totals.The problem is that after an expense is put on hold, the approver can already receive the held state on the transaction, so the partial-approve option appears, while their copy of the report may still have stale
unheldTotal/unheldReimbursableTotalvalues equal to the full total.That makes both options display the same amount.
The same stale report fields are also used by the partial approve/pay paths, so this can affect not only the label shown to the user, but also the optimistic amount submitted.
What changes do you think we should make in order to solve the problem?
Keep preferring backend-computed
unheld*fields when they are consistent, but add a fallback when held transactions prove those fields are stale.Instead of summing unheld transactions, derive the non-held amount as:
full report total - sum(held transaction amounts in report currency)This is safer because some callers may have only a partial transaction list; summing the visible unheld transactions could therefore undercount the real pending amount.
I would:
getNonHeldAndFullAmount.getNonHeldAndFullAmountReportWorkflowPayMoneyRequestThis keeps the displayed amount and submitted amount consistent without broadly replacing the backend totals logic.
What alternative solutions did you explore?
Always recalculating the unheld amount from all unheld transactions would be broader and can be incorrect when a caller has an incomplete transaction list.
Updating only the optimistic
unheld*fields inputOnHoldalso would not fully solve this case, because that optimistic update runs on the client that places the hold, not necessarily on the approver's client.Test Plan
Add focused unit coverage for:
unheldTotal === fullTotalwith one held and one unheld transaction → partial amount excludes the held expense.unheldTotalis preserved.Also verify that the same calculated partial amount is used by the approve/pay submission paths.
Manual repro:
114 remaining items
melvin-bot commentedon Nov 3, 2026
@amyevans 10 days overdue. I'm getting more depressed than Marvin.
melvin-bot commentedon Nov 3, 2026
@amyevans 10 days overdue. Is anyone even seeing these? Hello?
melvin-bot commentedon Nov 3, 2026
@amyevans 10 days overdue. Is anyone even seeing these? Hello?
brunovjk commentedon Nov 3, 2026
Not overdue
amyevans commentedon Nov 3, 2026
Thanks for your patience here! I confirmed the backend root cause and will work on a PR to fix it there.
amyevans commentedon Nov 4, 2026
PR is in review: https://github.com/Expensify/Auth/pull/26270
melvin-bot commentedon Nov 11, 2026
@amyevans Whoops! This issue is 2 days overdue. Let's get this updated quick!
amyevans commentedon Nov 11, 2026
Ah whoops the PR deployed last week, closing!