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
[Awaiting Checklist] [$250] Track distance -In self DM, distance edited is not updated in 1:1 chat but updated amount is shown. #76712
It’ll work in offline mode because BE will return the outdated distance, rate in transaction
To fix this issue, we should pass the new distance, rate and unit to BE as well
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 [-]Track distance -In self DM, distance edited is not updated in 1:1 chat but updated amount is shown.[/-][+][$250] Track distance -In self DM, distance edited is not updated in 1:1 chat but updated amount is shown.[/+]on Dec 5, 2025
Please re-state the problem that we are trying to solve in this issue.
In self DM, distance edited is not updated in 1:1 chat but updated amount is shown
What is the root cause of that problem?
While moving the expense from self dm and changing the waypoint the transaction?.routes?.route0?.distance changes but merchant stays the same. We don't have the logic that watches for distance change
What changes do you think we should make in order to solve the problem?
Add a useEffect that in IOURequestStepDistance.tsx that watches transaction?.routes?.route0?.distance and recalculates the merchant when the route distance changes and also sets setMoneyRequestMerchant
We can do something like this
useEffect(() => {
// Only run for distance requests (not manual distance, which uses customUnit.quantity)
const isDistanceRequest = iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE || iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_MAP;
if (!isDistanceRequest || !transactionID || isEditing || !transaction) {
return;
}
// Check if we have a route with distance
const routeDistance = transaction?.routes?.route0?.distance;
if (!routeDistance) {
return;
}
// Get mileage rate info
const policyCurrency = policy?.outputCurrency ?? getPersonalPolicy()?.outputCurrency ?? CONST.CURRENCY.USD;
const mileageRates = DistanceRequestUtils.getMileageRates(policy);
const defaultMileageRate = DistanceRequestUtils.getDefaultMileageRate(policy);
const mileageRate: MileageRate | undefined = isCustomUnitRateIDForP2P(transaction)
? DistanceRequestUtils.getRateForP2P(policyCurrency, transaction)
: // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
(customUnitRateID && mileageRates?.[customUnitRateID]) || defaultMileageRate;
const {unit, rate} = mileageRate ?? {};
const currency = mileageRate?.currency ?? policyCurrency;
const hasRouteValue = hasRoute(transaction, true);
// Recalculate merchant with the latest route distance
const distanceMerchant = DistanceRequestUtils.getDistanceMerchant(hasRouteValue, routeDistance, unit, rate ?? 0, currency, translate, toLocaleDigit);
setMoneyRequestMerchant(transactionID, distanceMerchant, true);
}, [
transaction?.routes?.route0?.distance,
transactionID,
isEditing,
iouRequestType,
transaction,
policy,
customUnitRateID,
translate,
toLocaleDigit,
]);
I agree that the root cause of this is ConvertTrackedExpenseToRequest does not handle distance updates. It also does not parse distance and rate based on merchant.
To fix this issue, we should pass the new distance, rate and unit to BE as well
I think this is the right solution we need. Need to pass separated distance, customUnitRateID, waypoints and isDistance: true params to ConvertTrackedExpenseToRequest endpoint just like what we do with TrackExpense endpoint .
I'm keen on hearing an internal engineer opinion whether this is feasible.
changed the title [-][$250] Track distance -In self DM, distance edited is not updated in 1:1 chat but updated amount is shown.[/-][+][Awaiting Checklist] [$250] Track distance -In self DM, distance edited is not updated in 1:1 chat but updated amount is shown.[/+]on Mar 17, 2026
[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: This didn't work from the beginning. The root cause was "missing feature" in both frontend and backend.
[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:
[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 Dec 4, 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.thelullabyy commentedon Dec 4, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
In self DM, distance edited is not updated in 1:1 chat but updated amount is shown.
What is the root cause of that problem?
When users create the track expense, we’ll generate the merchant based on distance, rate and unit like
distance @ rate / unitIf users move it to someone but change the distance or rate, we still use the generated merchant above, so it’s not correct
App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Line 574 in da79e09
What changes do you think we should make in order to solve the problem?
We should generate the new merchant if it’s the manual distance request in
Then use merchantToUse in
App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Line 574 in da79e09
It’ll work in offline mode because BE will return the outdated distance, rate in transaction
To fix this issue, we should pass the new distance, rate and unit to BE as well
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.
melvin-bot commentedon Dec 5, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021996901400348600339
[-]Track distance -In self DM, distance edited is not updated in 1:1 chat but updated amount is shown.[/-][+][$250] Track distance -In self DM, distance edited is not updated in 1:1 chat but updated amount is shown.[/+]melvin-bot commentedon Dec 5, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @dominictb (
External)Nodebrute commentedon Dec 6, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
In self DM, distance edited is not updated in 1:1 chat but updated amount is shown
What is the root cause of that problem?
While moving the expense from self dm and changing the waypoint the
transaction?.routes?.route0?.distancechanges but merchant stays the same. We don't have the logic that watches for distance changeWhat changes do you think we should make in order to solve the problem?
Add a
useEffectthat inIOURequestStepDistance.tsxthat watchestransaction?.routes?.route0?.distanceand recalculates the merchant when the route distance changes and also setssetMoneyRequestMerchantWe can do something like this
dominictb commentedon Dec 8, 2025
I agree that the root cause of this is
ConvertTrackedExpenseToRequestdoes not handle distance updates. It also does not parse distance and rate based onmerchant.I think this is the right solution we need. Need to pass separated
distance,customUnitRateID,waypointsandisDistance: trueparams toConvertTrackedExpenseToRequestendpoint just like what we do withTrackExpenseendpoint .I'm keen on hearing an internal engineer opinion whether this is feasible.
🎀 👀 🎀 C+ reviewed
51 remaining items
melvin-bot commentedon Mar 17, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)[-][$250] Track distance -In self DM, distance edited is not updated in 1:1 chat but updated amount is shown.[/-][+][Awaiting Checklist] [$250] Track distance -In self DM, distance edited is not updated in 1:1 chat but updated amount is shown.[/+]melvin-bot commentedon Mar 20, 2026
@garrettmknight Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Mar 20, 2026
@garrettmknight Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
garrettmknight commentedon Mar 23, 2026
@mkhutornyi bump on the checklist, please.
mkhutornyi commentedon Mar 24, 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: This didn't work from the beginning. The root cause was "missing feature" in both frontend and backend.
[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:
[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/615757
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-7279-a37c-6db6-0afa16aa5fd4mallenexpensify commentedon Mar 24, 2026
^ Test case created
Should be all good, closing
quinthar commentedon Mar 28, 2026
Approved $250 to @mkhutornyi