Skip to content

Migrate money request destination step to dynamic routes (#83850 part 1)#96949

Draft
suneox wants to merge 1 commit into
Expensify:mainfrom
suneox:83850-migrate-money-request-part-1-suneox
Draft

Migrate money request destination step to dynamic routes (#83850 part 1)#96949
suneox wants to merge 1 commit into
Expensify:mainfrom
suneox:83850-migrate-money-request-part-1-suneox

Conversation

@suneox

@suneox suneox commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Migrate the per-diem money-request Destination step (MONEY_REQUEST_STEP_DESTINATION, wizard entry from MONEY_REQUEST.CREATE) and its edit variant (MONEY_REQUEST_STEP_DESTINATION_EDIT, entry from STEP_CONFIRMATION) from static routes to dynamic URL navigation, removing the backTo/backToReport params. The step page is renamed IOURequestStepDestinationDynamicIOURequestStepDestination; edit mode is now derived from route.name and the back path from useDynamicBackPath. Forward entries and cross-file goBack targets (Time step, report-selection step) rebuild the absolute path via createDynamicRoute on the MONEY_REQUEST_CREATE base. OldRoutes redirects cover the legacy URLs, and the dynamic suffixes are namespaced per-diem-destination/per-diem-destination-edit (dynamic paths must be globally unique across DYNAMIC_ROUTES, since react-navigation flattens them — a bare destination collides 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_DESTINATIONwizard destination step (non-edit)

Case 1.1 — Workspace select → Destination (forward entry)

Target: src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx:77

Precondition: ≥2 per-diem workspaces (workspace selector is shown).

Steps:

  1. Open the app and log in.
  2. FAB → Create expensePer diem tab.
  3. Select a workspace from the list.

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:

  1. From Case 1.1 (on Destination), tap the header Back button.

Expected: Returns to the Workspace select / Start screen (suffix /per-diem-destination stripped). No /not-found.


Case 1.3 — Destination → Time (forward)

Target: DynamicIOURequestStepDestination updateDestination

Steps:

  1. On Destination, select a destination (tap a rate).

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:99

Precondition: ≥2 per-diem workspaces (hasMoreThanOnePolicyWithPerDiemEnabled), global create.

Steps:

  1. From Case 1.3 (on Time), tap Back.

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:165

Precondition: per-diem transaction (global create); select a report from a different policy.

Steps:

  1. Global-create a per-diem expense; reach the Report selection step.
  2. Select a report from a different per-diem workspace (policy changes).

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:

  1. Open the legacy URL directly: /create/submit/destination/123/456.

Expected: Redirects to /create/submit/start/123/456/per-diem-destination; Destination opens, stack restored (back → start). ⚠️ Legacy query (?backTo=) is not preserved (append-suffix, accepted — no call site produces a query anymore).



DYNAMIC_ROUTES.MONEY_REQUEST_STEP_DESTINATION_EDITedit destination from Confirmation

Case 2.1 — Confirmation → edit Destination (forward entry)

Target: src/components/MoneyRequestConfirmationList/sections/PerDiemFields.tsx:111

Precondition: on the Confirmation step of a per-diem expense.

Steps:

  1. Complete the per-diem wizard to reach Confirmation.
  2. Tap the Destination field in the confirmation list.

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:

  1. From Case 2.1, select a different destination.

Expected: Returns to Confirmation (suffix /per-diem-destination-edit stripped); destination updated; subrates cleared if the destination changed.


Case 2.3 — Edit back button

Steps:

  1. From Case 2.1, tap Back (without selecting).

Expected: Returns to Confirmation, no change.


Case 2.4 — Deep-link edit + OldRoutes redirect

Steps:

  1. Open the legacy URL: /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.


  • Verify that no errors appear in the JS console

Offline tests

  • Same as tests — pure navigation refactor (static route → dynamic URL + OldRoutes redirect). No network/API behavior changed; offline forward/back/deep-link behavior is unchanged.

QA Steps

Test case 1: Open the per-diem Destination step from the workspace selector

  1. Log in on an account that belongs to ≥2 workspaces with per-diem rates enabled.
  2. Tap the FAB → Create expensePer diem tab.
  3. Select one of the per-diem workspaces from the "Choose a workspace" list.
  4. Verify the Destination step opens and the browser URL ends with /per-diem-destination (no ?backTo=).
  5. Tap the header Back button.
  6. Verify you return to the workspace/start screen and the URL no longer contains /per-diem-destination.

Test case 2: Edit the Destination from the per-diem confirmation screen

  1. Complete a per-diem expense through the wizard (Destination → Time → Subrate) to reach the Confirmation screen.
  2. Tap the Destination row in the confirmation list.
  3. Verify the Destination screen reopens in edit mode and the URL ends with /per-diem-destination-edit.
  4. Select a different destination.
  5. Verify you return to the Confirmation screen, the Destination value is updated, and the URL no longer contains /per-diem-destination-edit.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Case 1.1 — Workspace select → Destination (forward entry) 1 1-1-before-workspace-selector 1 1-2-entry-destination-dynamic
Case 1.2 — Destination back (cut suffix → start) 1 2-1-before-destination-dynamic 1 2-2-entry-start-cutsuffix
Case 1.3 — Destination → Time (forward) 1 3-1-before-destination-dynamic 1 3-2-entry-time-step
Case 1.4 — Time back → Destination (cross-file goBack) 1 4-1-before-time-step 1 4-2-entry-destination-dynamic
Case 1.5 — Report step policy change → Destination (new reportID) 1 5-1-before-confirmation-report 1 5-2-entry-destination-newreport
Case 1.6 — Deep-link / refresh + OldRoutes redirect (non-edit) 1 6-1-before-oldurl-nonedit 1 6-2-entry-redirected-nonedit
Case 2.1 — Confirmation → edit Destination (forward entry) 2 1-1-before-confirmation 2 1-2-entry-destination-edit
Case 2.2 — Edit select → back to Confirmation 2 2-1-before-destination-edit 2 2-2-entry-confirmation-updated
Case 2.3 — Edit back button 2 3-1-before-destination-edit 2 3-2-entry-confirmation-unchanged
Case 2.4 — Deep-link edit + OldRoutes redirect 2 4-1-before-oldurl-edit 2 4-2-entry-redirected-edit

…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

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant