Restore "#81017 Fix updates of distance and distance units when changing expense recipients" with fixes#82148
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
| !transactionID || | ||
| !lastSelectedRate || | ||
| isMovingTransactionFromTrackExpense || | ||
| !selectedParticipants.some((participant) => participant.policyID === policy?.id) |
There was a problem hiding this comment.
This is the only change added to this hook. This prevents situations where setCustomUnitRateID is called for a policy that is not a participant of the current transaction (was being called for example when for selfDM user tried to change rate and IOURequestStepUpgrade logic was used and updated transactions participants to the new workspace)
| } | ||
|
|
||
| const distanceRate = DistanceRequestUtils.getRateByCustomUnitRateID({policy, customUnitRateID}); | ||
| const newDistanceUnit = getDistanceRateCustomUnit(policy)?.attributes?.unit; |
There was a problem hiding this comment.
DistanceRequestUtils.getRateByCustomUnitRateID() was basically using this function under the hood, but by using it directly we do not require the transaction to have the passed customUnitRateID to be present in the transaction at the moment, which is crucial for when this function is called from CreateDistanceRatePage component immediately after customUnitRate is created (so policy object does not have it persisted yet)
jakubkalinski0
left a comment
There was a problem hiding this comment.
Looks very good! Excellent fix, well done 🚀
|
@dukenv0307 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
…ent-distance-unit
…ent-distance-unit
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc5e8cc001
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
All yours @dukenv0307 |
I think it should be |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-02-12.at.11.08.05.movAndroid: mWeb ChromeScreen.Recording.2026-02-12.at.11.00.47.moviOS: HybridAppScreen.Recording.2026-02-12.at.11.05.47.moviOS: mWeb SafariScreen.Recording.2026-02-12.at.10.58.31.movMacOS: Chrome / SafariScreen.Recording.2026-02-12.at.10.41.44.movScreen.Recording.2026-02-12.at.10.47.31.movScreen.Recording.2026-02-12.at.10.49.25.movScreen.Recording.2026-02-12.at.10.55.59.mov |
@dukenv0307 from what I've tested the new policies usually have miles set as default distance units (and when user upgrades the distance rates from selfDM a new policy is created which is set as a transaction's recipient). Do you have kilometers in this step instead? |
|
@GCyganek Ah ok, I misunderstood the unit on distance page Screen.Recording.2026-02-12.at.16.39.28.mov |
|
LGTM |
|
🚧 @rlinoz has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.19-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.3.19-5 🚀
|
Explanation of Change
Reverts #82023 with fixes that caused the #81017 to be reverted at first because of #82009 and #82004 which should be fixed in this PR
Easiest to review by checking commits one by one. First is a revert, second $ #82004 and third $ #82009
Fixed Issues
$ #80661
PROPOSAL: N/A
Tests
Preconditions:
GPS:
Manual:
Manual input:
=============================
test for #82004:
Precondition: Enable Distance rates in workspace settings.
=============================
test for #82009:
Precondition:
Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
GPS:
Screen.Recording.2026-02-11.at.17.38.29.mov
Manual:
Screen.Recording.2026-02-11.at.17.40.11.mov
Manual input:
Screen.Recording.2026-02-11.at.17.41.06.mov
iOS: Native
Manual:
Screen.Recording.2026-02-11.at.17.55.19.mov
GPS:
Screen.Recording.2026-02-11.at.17.54.43.mov
Manual input:
Screen.Recording.2026-02-11.at.17.55.43.mov
MacOS: Chrome / Safari
#82009 fix demo:
Screen.Recording.2026-02-11.at.16.43.39.mov
#82004 fix demo:
Screen.Recording.2026-02-11.at.16.46.05.mov