You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-02-27] [$250] Invoice - Invoice amount on receiver side in Pay option selected via checkbox in Reports page does not display the amount changed by sender #79417
Invoice sender has invited receiver to workspace
Steps:
Perform below steps on Sender's side:
Navigate to staging.new.expensify.com
Tap FAB >> Invoices >> Go through the flow & send an invoice to receiver
Navigate to invoice details & change the invoice amount
Perform below steps on Receiver's side
Navigate to staging.new.expensify.com
Go To Reports menu >> Invoice type
Select the invoice via checkbox
Select Pay option
Observe wrong invoice amount (does not show the edited amount done by sender) is displayed in Pay as individual & business option
Expected Result:
Invoice amount on receiver's side in Pay as individual & business option selected via checkbox in Reports page should display the correct edited amount changed by sender
Actual Result:
Invoice amount on receiver's side in Pay as individual & business option in Reports page does not display the correct edited amount changed by sender
Pay button dropdown show correct changed amount while the Pay option via checkbox still display the original amount done while creating invoice but not the edited amount
Please re-state the problem that we are trying to solve in this issue.
When a sender edits an invoice amount after sending it, the receiver sees the wrong (original) amount when selecting the invoice via checkbox in the Reports page and clicking the Pay option. The Pay button dropdown shows the correct edited amount, but the bulk Pay option via checkbox still displays the original amount.
What is the root cause of that problem?
The root cause is in src/components/Search/SearchContext.tsx. When invoices are selected via checkbox, the total value is captured from the search snapshot data and stored in selectedReports at the time of selection:
When the sender edits the invoice amount, the search snapshot data in selectedReports is not automatically refreshed with the new total from Onyx, causing the stale amount to be displayed.
What changes do you think we should make in order to solve the problem?
We should fetch the latest report total from live Onyx data instead of using the cached total from selectedReports. Specifically:
In SearchPage.tsx, when building paymentData for onBulkPaySelected, use the current report total from Onyx (currentSearchResults?.data?.[ONYXKEYS.COLLECTION.REPORT${reportID}]?.total) instead of report.total from selectedReports.
Similarly, update getTotalFormattedAmount to accept the current search results and fetch the latest total from Onyx for each selected report.
selectedReports.reduce((acc, report) => {
// Fetch the latest total from Onyx if allReports is provided, otherwise use cached total
const latestTotal = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`]?.total ?? report.total;
return acc + (Math.abs(latestTotal) ?? 0);
}, 0)
What alternative solutions did you explore? (Optional)
An alternative would be to invalidate/refresh selectedReports whenever report data changes in Onyx. However, this approach would add unnecessary complexity and performance overhead by requiring subscriptions to report changes. Fetching the latest data at payment time is simpler and more reliable.
🚨 Edited by proposal-police: This proposal was edited at 2026-01-16 20:31:55 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Invoice amount on receiver's side in Pay as individual & business option selected via checkbox in Reports page should display the correct edited amount changed by sender
What is the root cause of that problem?
The checkbox bulk-pay flow relies on selectedReports data captured at selection time from the search list item snapshot, including a total field. When the invoice is later edited, the authoritative report total is updated in Onyx, but the already-stored selectedReports[].total is not refreshed, so the bulk Pay UI/logic continues using a stale total.
What changes do you think we should make in order to solve the problem?
Use the cached snapshot total only as a fallback, but derive the amount for bulk invoice Pay from the latest report data when available:
When rendering the bulk Pay submenu (e.g., “Pay as individual/business”), compute the displayed total using the current report total for the selected reportIDs (live report data), falling back to the cached snapshot total if the live report is not available.
When constructing the bulk payment payload (the paymentData sent to payMoneyRequestOnSearch), use the latest report total for each selected invoice report, again with a fallback to the cached snapshot total.
Keep the selection model (selectedReports) as-is to avoid extra subscriptions/complexity; just re-resolve totals at “Pay” time.
This aligns the checkbox Pay flow with the already-correct behavior seen in the Pay button dropdown (which is based on live report data) and fixes the stale amount after edits.
We should add this code to SearchPage
What alternative solutions did you explore? (Optional)
We can apply the same “use latest report total” approach to any other pay paths that use snapshot totals for invoices, to avoid similar drift outside the checkbox flow.
changed the title [-]Invoice - Invoice amount on receiver side in Pay option selected via checkbox in Reports page does not display the amount changed by sender[/-][+][$250] Invoice - Invoice amount on receiver side in Pay option selected via checkbox in Reports page does not display the amount changed by sender[/+]on Jan 13, 2026
I don’t think using total from Onyx data is a good approach. In some cases, the Onyx data isn’t available before the report is opened. I think we should rely on the snapshot data instead, if possible.
A couple of clarifying questions:
Does the snapshot data include the modified amount? If so, why can’t we use it? If not, can we ask the backend to include it?
How do expense reports currently handle modified amounts? Can we align this behavior here?
Does the snapshot data include the modified amount?
Yes, but only after it’s refreshed. The Search “snapshot” (ONYXKEYS.COLLECTION.SNAPSHOT...) is essentially the cached result of the last Search API response. If the sender edits the invoice after the receiver last fetched Search, the receiver’s snapshot can still contain the old report.total. That’s why “just use snapshot” (especially the cached selectedReports.total captured at checkbox time) can still show the wrong amount.
If so, why can’t we use it? If not, can we ask the backend to include it?
We can use snapshot if we avoid caching and/or ensure the snapshot is updated. The core issue is staleness, not that the backend can’t represent the edited value. Asking the backend to “include it” doesn’t help unless we also ensure the receiver’s Search snapshot is refreshed at the right time (e.g., re-run Search when opening the bulk Pay menu, or update the snapshot when an invoice update arrives).
How do expense reports handle modified amounts? Can we align?
Expenses track edits at the transaction level (e.g., modifiedAmount, modifiedCurrency, etc.), and UI generally reflects updates via live model data rather than a one-time cached total. Aligning here would mean: don’t rely on a cached total captured at selection time; instead re-resolve the amount at render/pay time from the best available source (snapshot if it’s current, otherwise a refreshed snapshot / live data).
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A.
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
melvin-bot commentedon Jan 13, 2026
Triggered auto assignment to @brianlee-expensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.daledah commentedon Jan 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a sender edits an invoice amount after sending it, the receiver sees the wrong (original) amount when selecting the invoice via checkbox in the Reports page and clicking the Pay option. The Pay button dropdown shows the correct edited amount, but the bulk Pay option via checkbox still displays the original amount.
What is the root cause of that problem?
The root cause is in
src/components/Search/SearchContext.tsx. When invoices are selected via checkbox, thetotalvalue is captured from the search snapshot data and stored inselectedReportsat the time of selection:App/src/components/Search/SearchContext.tsx
Lines 93 to 104 in 98a3245
App/src/components/Search/SearchContext.tsx
Lines 105 to 117 in 98a3245
This cached
totalis then used by:App/src/libs/actions/Search.ts
Lines 1203 to 1211 in 98a3245
App/src/pages/Search/SearchPage.tsx
Line 526 in 98a3245
When the sender edits the invoice amount, the search snapshot data in
selectedReportsis not automatically refreshed with the new total from Onyx, causing the stale amount to be displayed.What changes do you think we should make in order to solve the problem?
We should fetch the latest report
totalfrom live Onyx data instead of using the cachedtotalfromselectedReports. Specifically:SearchPage.tsx, when buildingpaymentDataforonBulkPaySelected, use the current report total from Onyx (currentSearchResults?.data?.[ONYXKEYS.COLLECTION.REPORT${reportID}]?.total) instead ofreport.totalfromselectedReports.getTotalFormattedAmountto accept the current search results and fetch the latest total from Onyx for each selected report.App/src/libs/actions/Search.ts
Lines 1205 to 1208 in 98a3245
What alternative solutions did you explore? (Optional)
An alternative would be to invalidate/refresh
selectedReportswhenever report data changes in Onyx. However, this approach would add unnecessary complexity and performance overhead by requiring subscriptions to report changes. Fetching the latest data at payment time is simpler and more reliable.annaweber830 commentedon Jan 13, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-01-16 20:31:55 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Invoice amount on receiver's side in Pay as individual & business option selected via checkbox in Reports page should display the correct edited amount changed by sender
What is the root cause of that problem?
The checkbox bulk-pay flow relies on selectedReports data captured at selection time from the search list item snapshot, including a total field. When the invoice is later edited, the authoritative report total is updated in Onyx, but the already-stored selectedReports[].total is not refreshed, so the bulk Pay UI/logic continues using a stale total.
What changes do you think we should make in order to solve the problem?
Use the cached snapshot total only as a fallback, but derive the amount for bulk invoice Pay from the latest report data when available:
Keep the selection model (selectedReports) as-is to avoid extra subscriptions/complexity; just re-resolve totals at “Pay” time.
This aligns the checkbox Pay flow with the already-correct behavior seen in the Pay button dropdown (which is based on live report data) and fixes the stale amount after edits.
We should add this code to SearchPage
App/src/pages/Search/SearchPage.tsx
Line 182 in e54cfd4
App/src/pages/Search/SearchPage.tsx
Lines 196 to 197 in e54cfd4
App/src/pages/Search/SearchPage.tsx
Line 478 in e54cfd4
const selectedOptions = selectedReports.length ? selectedReportsWithLatestSnapshotTotals : Object.values(selectedTransactions);App/src/pages/Search/SearchPage.tsx
Lines 534 to 536 in e54cfd4
What alternative solutions did you explore? (Optional)
We can apply the same “use latest report total” approach to any other pay paths that use snapshot totals for invoices, to avoid similar drift outside the checkbox flow.
[-]Invoice - Invoice amount on receiver side in Pay option selected via checkbox in Reports page does not display the amount changed by sender[/-][+][$250] Invoice - Invoice amount on receiver side in Pay option selected via checkbox in Reports page does not display the amount changed by sender[/+]melvin-bot commentedon Jan 13, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022011218062525274970
melvin-bot commentedon Jan 13, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ahmedGaber93 (
External)ahmedGaber93 commentedon Jan 16, 2026
Thanks everyone for the proposals.
I don’t think using
totalfrom Onyx data is a good approach. In some cases, the Onyx data isn’t available before the report is opened. I think we should rely on the snapshot data instead, if possible.A couple of clarifying questions:
annaweber830 commentedon Jan 16, 2026
Hi @ahmedGaber93
Yes, but only after it’s refreshed. The Search “snapshot” (ONYXKEYS.COLLECTION.SNAPSHOT...) is essentially the cached result of the last Search API response. If the sender edits the invoice after the receiver last fetched Search, the receiver’s snapshot can still contain the old report.total. That’s why “just use snapshot” (especially the cached selectedReports.total captured at checkbox time) can still show the wrong amount.
We can use snapshot if we avoid caching and/or ensure the snapshot is updated. The core issue is staleness, not that the backend can’t represent the edited value. Asking the backend to “include it” doesn’t help unless we also ensure the receiver’s Search snapshot is refreshed at the right time (e.g., re-run Search when opening the bulk Pay menu, or update the snapshot when an invoice update arrives).
Expenses track edits at the transaction level (e.g., modifiedAmount, modifiedCurrency, etc.), and UI generally reflects updates via live model data rather than a one-time cached total. Aligning here would mean: don’t rely on a cached total captured at selection time; instead re-resolve the amount at render/pay time from the best available source (snapshot if it’s current, otherwise a refreshed snapshot / live data).
melvin-bot commentedon Jan 20, 2026
@ahmedGaber93 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
42 remaining items
brianlee-expensify commentedon Feb 28, 2026
@ahmedGaber93 bump for the above
marufsharifi commentedon Feb 28, 2026
@brianlee-expensify, please process the payment. I've accepted the offer. thanks.
ahmedGaber93 commentedon Feb 28, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/58334/changes#r2867790850
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A.
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/606264
Regression Test Proposal
Precondition:
Test:
Perform the following steps on the sender's side:
Perform the following steps on the receiver's side
Do we agree 👍 or 👎
ahmedGaber93 commentedon Feb 28, 2026
@brianlee-expensify checklist have been completed.
marufsharifi commentedon Mar 2, 2026
@brianlee-expensify, kindly bump. thanks.
brianlee-expensify commentedon Mar 2, 2026
Payment Summary
JmillsExpensify commentedon Mar 19, 2026
$250 approved for @ahmedGaber93
marufsharifi commentedon Mar 26, 2026
@brianlee-expensify, thanks for the payment. Could you please end the Upwork contract? thanks.