Fix distance request deeplink redirect#95436
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
| } else if (iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_GPS) { | ||
| Navigation.navigate(ROUTES.DISTANCE_REQUEST_CREATE_TAB_GPS.getRoute(CONST.IOU.ACTION.CREATE, iouType, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, optimisticReportID)); | ||
| if (iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE && iouType !== CONST.IOU.TYPE.SPLIT) { | ||
| startDistanceRequest(iouType, optimisticReportID, undefined); |
There was a problem hiding this comment.
❌ PERF-16 (docs)
This effect runs once on mount ([] dependency array) and performs non-idempotent work: it dismisses the modal and then triggers a redirect via startDistanceRequest/startMoneyRequest/Navigation.navigate. React Strict Mode intentionally double-invokes effects in development, so these navigation/request-start calls can fire twice, potentially opening two flows or starting duplicate money requests. The existing if (shouldShowNotFound) return; is a precondition check, not an execution guard — it does not prevent the redirect logic from running again on a second invocation.
Add a module-level (or ref-based) guard that both checks and sets a flag before performing the redirect, e.g.:
let didRedirect = false;
// inside the effect
if (shouldShowNotFound) {
return;
}
if (didRedirect) {
return;
}
didRedirect = true;
Navigation.dismissModal();
// ...redirect logicReviewed at: 6653af4 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-07-08.at.10.38.58.PM.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 yuwenmemon 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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.4.32-0 🚀
|
|
🤖 Help site review: no changes required. I reviewed the change in this PR and confirmed no updates to Expensify's help site files under Why no docs changes are needed
@emkhalid, since no help site PR was created, there is nothing to mark |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.4.32-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Fixes the
/start/request/distancedeeplink so generic non-split distance requests open the dedicated distance flow instead of falling back to the manual expense tab.This change is scoped to
IOURequestRedirectToStartPage:distanceopens the dedicated distance flow.split/distancecontinues opening the existing split Distance tab.split/distance-manual, display the existing Not Found view.startMoneyRequestorstartDistanceRequest, and no broader IOU type/request type validation is added.Fixed Issues
$ #92675
PROPOSAL: #92675 (comment)
Tests
/start/request/distance./start/split/distance./start/request/distance-map/start/request/distance-manual/start/request/distance-gps/start/request/distance-odometer/start/split/distance-map/start/split/distance-manual/start/split/distance-gps/start/split/distance-odometer/start/request/manualand/start/request/scan.Offline tests
/start/request/distance./start/split/distance./start/split/distance-manual.QA Steps
Same as tests.
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.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
macos-link-fix.mov