Migrate money request destination step to dynamic routes (#83850 part 1)#96949
Draft
suneox wants to merge 1 commit into
Draft
Migrate money request destination step to dynamic routes (#83850 part 1)#96949suneox wants to merge 1 commit into
suneox wants to merge 1 commit into
Conversation
…3850 part 1) Migrate MONEY_REQUEST_STEP_DESTINATION (path `destination`, entry MONEY_REQUEST.CREATE) and MONEY_REQUEST_STEP_DESTINATION_EDIT (path `destination-edit`, entry STEP_CONFIRMATION) to dynamic routes, removing their static routes and the `backTo` param. - Rename IOURequestStepDestination -> DynamicIOURequestStepDestination; edit mode now derived from route.name, back path from useDynamicBackPath. - Forward entries use createDynamicRoute; cross-file goBack targets (Time, report selection) rebuild the absolute path via createDynamicRoute with the MONEY_REQUEST_CREATE base. - Add OldRoutes redirects + getMatchingNewRoute unit tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
Migrate the per-diem money-request Destination step (
MONEY_REQUEST_STEP_DESTINATION, wizard entry fromMONEY_REQUEST.CREATE) and its edit variant (MONEY_REQUEST_STEP_DESTINATION_EDIT, entry fromSTEP_CONFIRMATION) from static routes to dynamic URL navigation, removing thebackTo/backToReportparams. The step page is renamedIOURequestStepDestination→DynamicIOURequestStepDestination; edit mode is now derived fromroute.nameand the back path fromuseDynamicBackPath. Forward entries and cross-file goBack targets (Time step, report-selection step) rebuild the absolute path viacreateDynamicRouteon theMONEY_REQUEST_CREATEbase. OldRoutes redirects cover the legacy URLs, and the dynamic suffixes are namespacedper-diem-destination/per-diem-destination-edit(dynamic paths must be globally unique acrossDYNAMIC_ROUTES, since react-navigation flattens them — a baredestinationcollides with the existing Sage Intacct suffix). Part 1 of #83850 (Time/Subrate are Parts 2/3).Fixed Issues
$ #83850
PROPOSAL:
Tests
DYNAMIC_ROUTES.MONEY_REQUEST_STEP_DESTINATION— wizard destination step (non-edit)Case 1.1 — Workspace select → Destination (forward entry)
Target:
src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx:77Precondition: ≥2 per-diem workspaces (workspace selector is shown).
Steps:
Expected: The Destination step opens; URL ends with
/start/<txn>/<rpt>/per-diem-destination(no?backTo=), title is the tab title.Case 1.2 — Destination back (cut suffix → start)
Steps:
Expected: Returns to the Workspace select / Start screen (suffix
/per-diem-destinationstripped). No/not-found.Case 1.3 — Destination → Time (forward)
Target:
DynamicIOURequestStepDestination updateDestinationSteps:
Expected: Navigates to the Time step (Time is still static in Part 1 — must work normally).
Case 1.4 — Time back → Destination (cross-file goBack)
Target:
src/pages/iou/request/step/IOURequestStepTime.tsx:99Precondition: ≥2 per-diem workspaces (
hasMoreThanOnePolicyWithPerDiemEnabled), global create.Steps:
Expected: Returns to the dynamic Destination step; rates shown and selectable. No
/not-found.Case 1.5 — Report step policy change → Destination (new reportID)
Target:
useReportSelectionActions.ts:165Precondition: per-diem transaction (global create); select a report from a different policy.
Steps:
Expected: Goes back to Destination with the new reportID; subrates cleared; Destination shows the new policy's rates. No
/not-found.Case 1.6 — Deep-link / refresh + OldRoutes redirect
Steps:
/create/submit/destination/123/456.Expected: Redirects to⚠️ Legacy query (
/create/submit/start/123/456/per-diem-destination; Destination opens, stack restored (back → start).?backTo=) is not preserved (append-suffix, accepted — no call site produces a query anymore).DYNAMIC_ROUTES.MONEY_REQUEST_STEP_DESTINATION_EDIT— edit destination from ConfirmationCase 2.1 — Confirmation → edit Destination (forward entry)
Target:
src/components/MoneyRequestConfirmationList/sections/PerDiemFields.tsx:111Precondition: on the Confirmation step of a per-diem expense.
Steps:
Expected: Destination opens in edit mode, title = "Destination"; URL
/confirmation/<txn>/<rpt>/per-diem-destination-edit.Case 2.2 — Edit select → back to Confirmation
Steps:
Expected: Returns to Confirmation (suffix
/per-diem-destination-editstripped); destination updated; subrates cleared if the destination changed.Case 2.3 — Edit back button
Steps:
Expected: Returns to Confirmation, no change.
Case 2.4 — Deep-link edit + OldRoutes redirect
Steps:
/create/submit/destination/123/456/edit.Expected: Redirects to
/create/submit/confirmation/123/456/per-diem-destination-edit; edit mode opens on top of Confirmation.Offline tests
QA Steps
Test case 1: Open the per-diem Destination step from the workspace selector
/per-diem-destination(no?backTo=)./per-diem-destination.Test case 2: Edit the Destination from the per-diem confirmation screen
/per-diem-destination-edit./per-diem-destination-edit.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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
Case 1.1 — Workspace select → Destination (forward entry)
Case 1.2 — Destination back (cut suffix → start)
Case 1.3 — Destination → Time (forward)
Case 1.4 — Time back → Destination (cross-file goBack)
Case 1.5 — Report step policy change → Destination (new reportID)
Case 1.6 — Deep-link / refresh + OldRoutes redirect (non-edit)
Case 2.1 — Confirmation → edit Destination (forward entry)
Case 2.2 — Edit select → back to Confirmation
Case 2.3 — Edit back button
Case 2.4 — Deep-link edit + OldRoutes redirect