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-11-26] Default distance rate is not selected when creating distance expense #72328
Version Number: v9.2.29-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#71529 Email or phone of affected tester (no customers):expensify416+da2@gmail.com Issue reported by: Applause Internal Team Device used: macOS chrome 14.2, mWeb, Android, Desktop App Component: Money Requests
Action Performed:
Create a new workspace
Enable Distance Rates
Add two new rates
Rename the two new rates to A, and B
Go to workspace chat
Click + > Track distance > select start and end way points > Next
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Currently, on getDefaultMileageRate, we get the first item in the mileageRates as the default rate. In this case, since we sort the mileageRates alphabetically, the rate named "A" will be the first one and preselected
As far as I know, we don't have any param to get the default distance rate value of a workspace. This is what mileageRates return before we clear cache and restart
My PR prevents this by sorting the rates in getDefaultMileageRate, but it will always preselect the first rate displayed. Since we don't have any param to define the default rate, I think it makes sense for the preselected rate to match the first rate in the UI list
However, we could implement a workaround, like searching for a rate with a specific name (like "Default Rate") before falling back to the first rate in the sorted list
As far as I know, we don't have any param to get the default distance rate value of a workspace.
That's correct, the first enabled rate in the rates JSON array is considered the default rate.
But when we clear the cache and restart, mileageRates get sorted 'randomly'
I think this is the real issue. Do you know what causes this random sorting? Is the list of rates returned in that order from the backend? It's stored as a JSON array in the policy object in the backend, so it should preserve its order.
However, we could implement a workaround, like searching for a rate with a specific name (like "Default Rate") before falling back to the first rate in the sorted list
Looks like we used similar logic in the backend until recently, but removed all that logic, so I'd recommend not going with that solution (cc @MonilBhavsar in case you have an opinion or suggestion here, cc #47801).
For now I'll demote but @nyomanjyotisa I'm thinking #71529 wasn't necessarily the proper solution to the issue, and we should instead figure out what's causing the unexpected sorting when we clear the cache.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.60-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@francoisl@CortneyOfstad / @stephanieelliott The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[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.
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.
N/A: This isn’t an impactful bug, as it only changes the default selected distance rates.
Activity
melvin-bot commentedon Oct 10, 2025
Triggered auto assignment to @stephanieelliott (
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.melvin-bot commentedon Oct 10, 2025
Triggered auto assignment to @francoisl (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Oct 10, 2025
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Oct 10, 2025
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
nyomanjyotisa commentedon Oct 10, 2025
This was coming from my PR
Currently, on
getDefaultMileageRate, we get the first item in themileageRatesas the default rate. In this case, since we sort themileageRatesalphabetically, the rate named "A" will be the first one and preselectedApp/src/libs/DistanceRequestUtils.ts
Line 81 in 188a8e7
As far as I know, we don't have any param to get the default distance rate value of a workspace. This is what
mileageRatesreturn before we clear cache and restartmileageRates before clearing cache
Then when we sort it alphabetically based on name, it would return this
mileageRates after sort
But when we clear the cache and restart,
mileageRatesget sorted 'randomly'mileageRates after clearing cache
If we don't sort the
getDefaultMileageRate, we will randomly preselect any rates that come first onmileageRatesafter we clearing the cache497648095-7d273726-76eb-454c-aced-086bd223dff2.mp4
My PR prevents this by sorting the rates in
getDefaultMileageRate, but it will always preselect the first rate displayed. Since we don't have any param to define the default rate, I think it makes sense for the preselected rate to match the first rate in the UI listHowever, we could implement a workaround, like searching for a rate with a specific name (like "Default Rate") before falling back to the first rate in the sorted list
But again, this is just a workaround and not the best solution
cc @ishpaul777
francoisl commentedon Oct 10, 2025
That's correct, the first enabled rate in the
ratesJSON array is considered the default rate.I think this is the real issue. Do you know what causes this random sorting? Is the list of rates returned in that order from the backend? It's stored as a JSON array in the policy object in the backend, so it should preserve its order.
Looks like we used similar logic in the backend until recently, but removed all that logic, so I'd recommend not going with that solution (cc @MonilBhavsar in case you have an opinion or suggestion here, cc #47801).
For now I'll demote but @nyomanjyotisa I'm thinking #71529 wasn't necessarily the proper solution to the issue, and we should instead figure out what's causing the unexpected sorting when we clear the cache.
51 remaining items
melvin-bot commentedon Nov 19, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Nov 19, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.60-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-11-26. 🎊
melvin-bot commentedon Nov 19, 2025
@francoisl @CortneyOfstad / @stephanieelliott The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
suneox commentedon Nov 26, 2025
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.
Fix: Order of distance rates on confirm page changes after reset app #71529 (comment)
[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.
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.
N/A: This isn’t an impactful bug, as it only changes the default selected distance rates.
suneox commentedon Nov 26, 2025
@CortneyOfstad Could you please assign me to this issue since I’ve reviewed this PR?
CortneyOfstad commentedon Dec 1, 2025
Thanks for your patience @suneox! With the Thanksgiving holiday, and confirmation needed on payment amount, this got a bit delayed 👍
CortneyOfstad commentedon Dec 1, 2025
Payment Summary
@suneox — to be paid $250 via NewDot
Regression Test
N/A: This isn’t an impactful bug, as it only changes the default selected distance rates.
garrettmknight commentedon Dec 18, 2025
$250 approved for @suneox