Skip to content

Migrate money request subrate step to dynamic routes (#83850 part 3)#96964

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

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

Conversation

@suneox

@suneox suneox commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Migrate the per-diem money-request Subrate step (MONEY_REQUEST_STEP_SUBRATE, path per-diem-subrate/:pageIndex, entry from STEP_TIME) and its edit variant (MONEY_REQUEST_STEP_SUBRATE_EDIT, path per-diem-subrate-edit/:pageIndex, entry from STEP_CONFIRMATION) from static routes to dynamic URL navigation, removing the backTo/backToReport params. The pageIndex is a real path param carried via getRoute(index). The step page is renamed IOURequestStepSubrateDynamicIOURequestStepSubrate; edit mode is derived from route.name and the back path from useDynamicBackPath (cutting the parametric suffix). The Time forward and confirmation goBack build the subrate route on the Time base via createDynamicRoute; confirmation edit uses getRoute(index). OldRoutes redirects preserve pageIndex. Part 3 of #83850 (Destination is Part 1, Time is Part 2).

Fixed Issues

$ #83850
PROPOSAL:

Tests

DYNAMIC_ROUTES.MONEY_REQUEST_STEP_SUBRATEwizard subrate step (non-edit)

Case 1.1 — Time → Subrate forward

Target: IOURequestStepTime.tsx:133

Precondition: per-diem flow reached the Time step (destination + workspace already chosen).

Steps:

  1. Per-diem flow → Time step → enter date-time → Save.

Expected: The Subrate step opens; URL .../time/<txn>/<rpt>/per-diem-subrate/0; subrate picker + quantity shown (pageIndex 0).


Case 1.2 — Subrate back → Time (cut parametric suffix)

Steps:

  1. From Case 1.1 (Subrate), tap Back.

Expected: Returns to Time (suffix /per-diem-subrate/0 stripped). No /not-found.


Case 1.3 — Subrate submit → Confirmation

Steps:

  1. On Subrate, select a subrate + enter a quantity → Save.

Expected: Navigates to Confirmation (static route, Part 3 has not migrated Confirmation).


Case 1.4 — Confirmation back → Subrate (cross-file goBack)

Target: IOURequestStepConfirmation.tsx:721

Steps:

  1. From Confirmation (per-diem), tap Back.

Expected: Returns to the dynamic Subrate step. No /not-found.


Case 1.5 — Deep-link + OldRoutes redirect (keeps pageIndex)

Steps:

  1. Open the legacy URL: /create/submit/subrate/123/456/0.

Expected: Redirects to /create/submit/time/123/456/per-diem-subrate/0; Subrate opens. ⚠️ Legacy query / backToReport not preserved (accepted).



DYNAMIC_ROUTES.MONEY_REQUEST_STEP_SUBRATE_EDITedit subrate from Confirmation (pageIndex)

Case 2.1 — Confirmation → edit Subrate (forward, index)

Target: PerDiemFields.tsx:55

Precondition: Confirmation of a per-diem expense with ≥1 subrate.

Steps:

  1. On Confirmation, tap the Nth subrate field (e.g. index 1).

Expected: Subrate opens in edit mode, title = "Subrate"; URL .../confirmation/<txn>/<rpt>/per-diem-subrate-edit/1; the correct subrate (index 1) is shown.


Case 2.2 — Edit save → back to Confirmation

Steps:

  1. From Case 2.1, change the subrate/quantity → Save.

Expected: Returns to Confirmation (suffix /per-diem-subrate-edit/1 stripped); subrate updated.


Case 2.3 — Edit delete subrate (3-dots menu)

Steps:

  1. From Case 2.1 (with >1 subrate), tap the 3-dots menu → Delete subrate → confirm.

Expected: Subrate deleted → returns to Confirmation (goBack backPath).


Case 2.4 — Deep-link edit + OldRoutes redirect

Steps:

  1. Open the legacy URL: /create/submit/subrate/123/456/edit/2.

Expected: Redirects to /create/submit/confirmation/123/456/per-diem-subrate-edit/2; edit mode at index 2.


  • Verify that no errors appear in the JS console

Offline tests

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

QA Steps

Test case 1: Open the per-diem Subrate step from the Time step

  1. Log in on an account that belongs to a workspace with per-diem rates enabled.
  2. Start a per-diem expense (FAB → Create expense → Per diem → select workspace → select destination).
  3. On the Time step, enter a start/end time → Save.
  4. Verify the Subrate step opens and the browser URL ends with /per-diem-subrate/0 (no ?backTo=).
  5. Tap the header Back button.
  6. Verify you return to the Time step and the URL no longer contains /per-diem-subrate/0.

Test case 2: Edit a subrate 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 subrate row in the confirmation list.
  3. Verify the Subrate screen reopens in edit mode and the URL ends with /per-diem-subrate-edit/0.
  4. Change the quantity and tap Save.
  5. Verify you return to the Confirmation screen, the subrate value is updated, and the URL no longer contains /per-diem-subrate-edit/0.
  • 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.getBackgroundAndStyle(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 — Time → Subrate forward 1 1-1-before-time-step 1 1-2-entry-subrate-dynamic
Case 1.2 — Subrate back → Time (cut parametric suffix) 1 2-1-before-subrate-dynamic 1 2-2-entry-time-step
Case 1.3 — Subrate submit → Confirmation 1 3-1-before-subrate-step 1 3-2-entry-confirmation-step
Case 1.4 — Confirmation back → Subrate (cross-file goBack) 1 4-1-before-confirmation-step 1 4-2-entry-subrate-dynamic
Case 1.5 — Deep-link + OldRoutes redirect (keeps pageIndex) 1 5-1-before-oldurl-nonedit 1 5-2-entry-redirected-nonedit
Case 2.1 — Confirmation → edit Subrate (forward, index) 2 1-1-before-confirmation 2 1-2-entry-subrate-edit
Case 2.2 — Edit save → back to Confirmation 2 2-1-before-subrate-edit 2 2-2-entry-confirmation-updated
Case 2.3 — Edit delete subrate (3-dots menu) 2 3-1-before-subrate-edit 2 3-2-entry-after-delete
Case 2.4 — Deep-link edit + OldRoutes redirect 2 4-1-before-oldurl-edit 2 4-2-entry-redirected-edit

…part 3)

Migrate MONEY_REQUEST_STEP_SUBRATE (path `subrate/:pageIndex`, entry
STEP_TIME) and MONEY_REQUEST_STEP_SUBRATE_EDIT (path `subrate-edit/:pageIndex`,
entry STEP_CONFIRMATION) to dynamic routes, removing their static routes
and the `backTo` param. The `pageIndex` path param is carried via getRoute.

- Rename IOURequestStepSubrate -> DynamicIOURequestStepSubrate; edit mode
  from route.name, back path from useDynamicBackPath (parametric suffix).
- Time forward and confirmation goBack build the subrate route on the time
  base via createDynamicRoute; confirmation edit uses getRoute(index).
- Add OldRoutes redirects (pageIndex preserved) + getMatchingNewRoute tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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