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 2025-10-31] [$250] Expense - In confirm page, tax amount not updated accordingly to new waypoints selected #72380
Please re-state the problem that we are trying to solve in this issue.
When a workspace distance expense is edited to use a different set of waypoints, the confirmation page continues to display the tax amount that was calculated for the previous route. The amount only refreshes several seconds after the expense is created, so reviewers cannot validate the tax value before submitting the expense.
What is the root cause of that problem?
While we recompute the distance amount before leaving the waypoint step, we do not recompute the related tax amount. The calculation lives in setDistanceRequestData, which only calls setMoneyRequestAmount and leaves the cached taxAmount unchanged
// In Send Money and Split Bill with Scan flow, we don't allow the Merchant or Date to be edited. For distance requests, don't show the merchant as there's already another "Distance" menu item
What changes do you think we should make in order to solve the problem?
Add a shared helper in DistanceRequestUtils that produces the updated tax amount (in backend units) for a distance transaction given the policy, the route distance, and the selected rate. The helper will guard on tax tracking being enabled and reuse the existing tax utilities so we keep rounding behaviour consistent.
Call that helper whenever we recalculate the distance amount:
In setDistanceRequestData we will set both the amount and tax amount before we navigate to confirmation, ensuring optimistic data is complete for new expenses.
In updateMoneyRequestDistance we will include the recomputed taxAmount in the optimistic transactionChanges, so editing an existing expense updates the preview immediately.
MoneyRequestConfirmationList can reuse the helper to avoid duplicating the formula; this keeps the confirmation step consistent with the waypoint step.
Please re-state the problem that we are trying to solve in this issue.
Expense - In confirm page, tax amount not updated accordingly to new waypoints selected
What is the root cause of that problem?
The root cause of the issue is that when we go back from the confirmation step to select waypoints, the MoneyRequestConfirmationList component is unmounted and after that when we select new waypoints and again go the confirmation page, the component MoneyRequestConfirmationList is mounted again with updated transaction prop and our usePrevious hook only keeps track of previous value during rerenders and not at the time of component mounting. So our previous and current values of the transaction match in this condition and the early return happens without calculating the tax:
What changes do you think we should make in order to solve the problem?
Just like how we are doing it at other places, we need to keep a ref variable for checking the first render and calculate the tax amount whenever first render is true. we can make the following changes here:
We are already having a check of previousTransactionAmount === transaction.amount , so adding previous and current distance check here is not required here. Optionally we can add that too during PR review after discussion.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
changed the title [-]Expense - In confirm page, tax amount not updated accordingly to new waypoints selected[/-][+][$250] Expense - In confirm page, tax amount not updated accordingly to new waypoints selected[/+]on Oct 13, 2025
@garrettmknight Just curious to know if there will be any compensation for me, since my proposal was earlier reviewed and selected here, but later It was decided that internal engineer ( @roryabraham ) will handle all the changes.
Activity
melvin-bot commentedon Oct 11, 2025
Triggered auto assignment to @garrettmknight (
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.ShridharGoel commentedon Oct 11, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace distance expense is edited to use a different set of waypoints, the confirmation page continues to display the tax amount that was calculated for the previous route. The amount only refreshes several seconds after the expense is created, so reviewers cannot validate the tax value before submitting the expense.
What is the root cause of that problem?
While we recompute the distance amount before leaving the waypoint step, we do not recompute the related tax amount. The calculation lives in
setDistanceRequestData, which only callssetMoneyRequestAmountand leaves the cachedtaxAmountunchangedApp/src/pages/iou/request/step/IOURequestStepDistance.tsx
Lines 151 to 180 in 35e6f75
The confirmation UI then reads the stale value from
transaction.taxAmount, so the user sees the old tax total until a later Onyx sync overwrites it.App/src/components/MoneyRequestConfirmationListFooter.tsx
Lines 340 to 360 in 35e6f75
What changes do you think we should make in order to solve the problem?
DistanceRequestUtilsthat produces the updated tax amount (in backend units) for a distance transaction given the policy, the route distance, and the selected rate. The helper will guard on tax tracking being enabled and reuse the existing tax utilities so we keep rounding behaviour consistent.setDistanceRequestDatawe will set both the amount and tax amount before we navigate to confirmation, ensuring optimistic data is complete for new expenses.updateMoneyRequestDistancewe will include the recomputedtaxAmountin the optimistictransactionChanges, so editing an existing expense updates the preview immediately.MoneyRequestConfirmationListcan reuse the helper to avoid duplicating the formula; this keeps the confirmation step consistent with the waypoint step.Burhan-Rashid commentedon Oct 11, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - In confirm page, tax amount not updated accordingly to new waypoints selected
What is the root cause of that problem?
The root cause of the issue is that when we go back from the confirmation step to select waypoints, the MoneyRequestConfirmationList component is unmounted and after that when we select new waypoints and again go the confirmation page, the component MoneyRequestConfirmationList is mounted again with updated transaction prop and our usePrevious hook only keeps track of previous value during rerenders and not at the time of component mounting. So our previous and current values of the transaction match in this condition and the early return happens without calculating the tax:
App/src/components/MoneyRequestConfirmationList.tsx
Lines 493 to 504 in 35e6f75
What changes do you think we should make in order to solve the problem?
Just like how we are doing it at other places, we need to keep a ref variable for checking the first render and calculate the tax amount whenever first render is true. we can make the following changes here:
App/src/components/MoneyRequestConfirmationList.tsx
Line 282 in 35e6f75
and add the condition of firstRenderRef in this useEffect:
App/src/components/MoneyRequestConfirmationList.tsx
Lines 493 to 504 in 35e6f75
We are already having a check of previousTransactionAmount === transaction.amount , so adding previous and current distance check here is not required here. Optionally we can add that too during PR review after discussion.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
[-]Expense - In confirm page, tax amount not updated accordingly to new waypoints selected[/-][+][$250] Expense - In confirm page, tax amount not updated accordingly to new waypoints selected[/+]melvin-bot commentedon Oct 13, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021977797907417201955
melvin-bot commentedon Oct 13, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee (
External)37 remaining items
melvin-bot commentedon Oct 31, 2025
Payment Summary
Upwork Job
BugZero Checklist (@garrettmknight)
Burhan-Rashid commentedon Nov 3, 2025
@garrettmknight Just curious to know if there will be any compensation for me, since my proposal was earlier reviewed and selected here, but later It was decided that internal engineer ( @roryabraham ) will handle all the changes.
garrettmknight commentedon Nov 4, 2025
Checking with @roryabraham on whether the solution materially differed.
roryabraham commentedon Nov 4, 2025
Yeah, I think my solution was materially different from any of the other proposals here
garrettmknight commentedon Nov 4, 2025
Thanks, no payments in that case outside of the C+ review.
Burhan-Rashid commentedon Nov 4, 2025
Thanks for the info. 👍
garrettmknight commentedon Nov 4, 2025
Payment summary is correct. @jjcoffee go ahead and request!
trjExpensify commentedon Nov 6, 2025
approved $250 for @jjcoffee.