Skip to content

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

Merged
mjasikowski merged 3 commits into
Expensify:mainfrom
suneox:83850-migrate-money-request-part-1-suneox
Jul 28, 2026
Merged

mjasikowski merged 3 commits 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 IOURequestStepDestination → DynamicIOURequestStepDestination; 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_DESTINATION — wizard 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 expense → Per 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_EDIT — edit 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 expense → Per 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

CleanShot.2026-07-27.at.18.24.29.1.mp4
CleanShot.2026-07-27.at.18.29.57.1.mp4
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

@suneox
suneox marked this pull request as ready for review July 27, 2026 11:15
@suneox
suneox requested review from a team as code owners July 27, 2026 11:15
@melvin-bot
melvin-bot Bot requested review from heyjennahay and huult and removed request for a team July 27, 2026 11:15
@melvin-bot

melvin-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

@huult 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]

@melvin-bot
melvin-bot Bot removed the request for review from a team July 27, 2026 11:15
@huult

huult commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • 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 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-07-28.at.15.14.33.mov
Screen.Recording.2026-07-28.at.15.15.42.mov

@huult huult left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@melvin-bot
melvin-bot Bot requested a review from mjasikowski July 28, 2026 08:20
@mjasikowski
mjasikowski merged commit 3cbdc3c into Expensify:main Jul 28, 2026
39 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mjasikowski has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mjasikowski in version: 9.4.46-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site changes are required for this PR.

This is a pure internal navigation refactor — it migrates the per-diem money-request Destination step (and its edit variant) from static routes to dynamic URL navigation, renames a component (IOURequestStepDestination → DynamicIOURequestStepDestination), removes the backTo/backToReport params, and adds OldRoutes redirects for the legacy URLs. As the PR description itself notes, this is a "pure navigation refactor (static route → dynamic URL + OldRoutes redirect). No network/API behavior changed."

The help site articles under App/docs/articles document user-facing product behavior — they don't reference internal route names, URL suffixes (e.g. per-diem-destination), or navigation internals. Nothing a user sees or does changes here, so no article needs updating. (I also confirmed there are no existing help articles that mention per-diem destination flows.)

No draft PR was created since no documentation changes are warranted, so there's no linked help site PR to review here.

@suneox, if you believe a user-facing behavior did change and warrants a docs update, let me know and I'll create the draft PR.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.4.46-10 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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.

6 participants