Fix distance rate auto-selection when submitting from Self DM to workspace#85918
Fix distance rate auto-selection when submitting from Self DM to workspace#85918
Conversation
…space Add targeted guard to the auto-rate-update effect so that it blocks when isMovingTransactionFromTrackExpense is true AND customUnitRateID is FAKE_P2P_ID (submit-to-workspace flow), but allows when customUnitRateID is '-1' (upgrade/new-rate-creation flow). This preserves the fix from PR #84850 for issue #82629 while restoring the correct "Rate not valid" validation error for the Self DM submission flow. Co-authored-by: Joel Davies <jjcoffee@users.noreply.github.com>
|
The failing check ( Analysis: The Android build fails with: This is a build infrastructure / dependency issue — the Evidence: This PR only modifies Re-running the check or merging from |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
The failing checks are unrelated to this PR's changes. Failing checks:
Why unrelated: This PR only modifies |
|
@MelvinBot make this ready for review. |
|
@aimane-chnaif 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] |
|
PR has been marked as ready for review! 🚀 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid-app-regression-2026-03-20_12.41.12.mp4Android: mWeb Chromeandroid-chrome-regression-2026-03-20_12.47.58.mp4iOS: HybridAppios-app-regression-2026-03-20_12.24.48.mp4iOS: mWeb Safariios-safari-regression-2026-03-20_12.25.44.mp4MacOS: Chrome / Safaridesktop-chrome-regression-2026-03-20_11.29.36.mp4 |
|
@aimane-chnaif ignore the ping, this is a regression from my PR 🙏 |
|
Is this PR needed? Original PR was reverted in #85890. |
|
@aimane-chnaif Yes, it's a fix PR. |
|
@MelvinBot please merge main. |
|
I was unable to merge main into this branch. The branch has only a single orphan commit (no shared history with The only file this PR actually changes is |
|
@MelvinBot That's weird, but yes go ahead with the suggested fix. |
|
Closed this PR and created a replacement with a proper branch based on The code change is identical. The old branch had orphan history (no shared commits with |
Explanation of Change
PR #84850 removed the
isMovingTransactionFromTrackExpenseguard from the auto-rate-updateuseEffectinMoneyRequestConfirmationList.tsxto fix issue #82629 (new custom rates not being selected after upgrade flow). However, removing the guard entirely also affected the standard Self DM submission flow, causing it to auto-select the workspace's distance rate instead of showing the "Rate not valid for this workspace" error.This PR adds a targeted guard that distinguishes between the two flows based on the sentinel value of
customUnitRateID:FAKE_P2P_ID(submit-from-Self-DM flow): The guard blocks the auto-rate-update effect, allowing the rate validation effect to correctly show the "Rate not valid" error.'-1'(upgrade/new-rate-creation flow): The guard does NOT block, preserving the fix from PR Fix distance rate not selected after creating new rate from self DM #84850 for issue [Due for payment 2026-03-30] [$250] Distance - New rate is not selected after entering new rate when submitting distance from self DM #82629.Fixed Issues
$ #85879
PROPOSAL: #85879 (comment)
Tests
Offline tests
N/A - This change only affects the rate selection logic on the confirmation page, which requires online access to fetch policy rates.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari