Skip to content

Migrate money request time step to dynamic routes (#83850 part 2)#96963

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

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

Conversation

@suneox

@suneox suneox commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Migrate the per-diem money-request Time step (MONEY_REQUEST_STEP_TIME, entry from STEP_DESTINATION / MONEY_REQUEST.CREATE) and its edit variant (MONEY_REQUEST_STEP_TIME_EDIT, entry from STEP_CONFIRMATION) from static routes to dynamic URL navigation, removing the backTo/backToReport params. The step page is renamed IOURequestStepTimeDynamicIOURequestStepTime; edit mode is derived from route.name and the back path from useDynamicBackPath (replacing the old reconstructed conditional back logic — backTo / hasMoreThanOnePolicy / CREATE_TAB_PER_DIEM). The destination forward builds Time on the start base when the destination is inline on the start page (single per-diem policy, openedFromStartPage) and on the destination base otherwise; subrate goBack and confirmation edit use createDynamicRoute. OldRoutes redirects cover the legacy URLs, and the dynamic suffixes are namespaced per-diem-time/per-diem-time-edit (globally unique across DYNAMIC_ROUTES). Part 2 of #83850 (Destination is Part 1, Subrate is Part 3).

Fixed Issues

$ #83850
PROPOSAL:

Tests

DYNAMIC_ROUTES.MONEY_REQUEST_STEP_TIMEwizard time step (non-edit)

Case 1.1 — Destination → Time forward (multi-policy)

Target: IOURequestStepDestination.tsx updateDestination

Precondition: ≥2 per-diem workspaces (destination shown as an RHP after selecting a workspace).

Steps:

  1. FAB → Create expense → Per diem → select a workspace → select a destination.

Expected: The Time step opens; URL .../destination/<txn>/<rpt>/per-diem-time; title is the tab title.


Case 1.2 — Time back → Destination (multi-policy, cut suffix)

Steps:

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

Expected: Returns to the Destination RHP (suffix /per-diem-time stripped). No /not-found.


Case 1.3 — Single-policy Time back → Start

Precondition: exactly one per-diem workspace (destination shown inline on the start tab, openedFromStartPage).

Steps:

  1. FAB → Create expense → Per diem tab (inline destination) → select a destination → Time opens (.../start/<txn>/<rpt>/per-diem-time).
  2. Tap Back on Time.

Expected: Returns to the Start page per-diem tab (suffix /per-diem-time stripped → start base). ⚠️ Verify it does not land on a destination RHP.


Case 1.4 — Time → Subrate forward (Subrate still static in Part 2)

Steps:

  1. From Time, enter start/end date-time → tap Save.

Expected: Navigates to Subrate (Part 2 has not migrated Subrate — static route, must work normally).


Case 1.5 — Subrate back → Time (cross-file goBack)

Target: IOURequestStepSubrate.tsx:130

Steps:

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

Expected: Returns to the dynamic Time step; pickers shown. No /not-found.


Case 1.6 — Deep-link + OldRoutes redirect

Steps:

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

Expected: Redirects to /create/submit/destination/123/456/per-diem-time; Time opens, back → destination. ⚠️ Legacy query (?backTo=) not preserved (append-suffix, accepted).



DYNAMIC_ROUTES.MONEY_REQUEST_STEP_TIME_EDITedit time from Confirmation

Case 2.1 — Confirmation → edit Time (forward)

Target: PerDiemFields.tsx:128

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

Steps:

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

Expected: Time opens in edit mode, title = "Time"; URL .../confirmation/<txn>/<rpt>/per-diem-time-edit.


Case 2.2 — Edit save → back to Confirmation

Steps:

  1. From Case 2.1, change the date-time → Save.

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


Case 2.3 — Edit back button

Steps:

  1. From Case 2.1, tap Back.

Expected: Returns to Confirmation, no change.


Case 2.4 — Deep-link edit + OldRoutes redirect

Steps:

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

Expected: Redirects to /create/submit/confirmation/123/456/per-diem-time-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 Time step from the Destination step

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

Test case 2: Edit the Time 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 Time row in the confirmation list.
  3. Verify the Time screen reopens in edit mode and the URL ends with /per-diem-time-edit.
  4. Change the time and tap Save.
  5. Verify you return to the Confirmation screen, the Time value is updated, and the URL no longer contains /per-diem-time-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.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 — Destination → Time forward (multi-policy) 1 1-1-before-destination-step 1 1-2-entry-time-dynamic
Case 1.2 — Time back → Destination (multi-policy, cut suffix) 1 2-1-before-time-dynamic 1 2-2-entry-destination-step
Case 1.3 — Single-policy Time back → Start 1 3-1-before-time-createbase 1 3-2-entry-start-cutsuffix
Case 1.4 — Time → Subrate forward 1 4-1-before-time-step 1 4-2-entry-subrate-step
Case 1.5 — Subrate back → Time (cross-file goBack) 1 5-1-before-subrate-step 1 5-2-entry-time-dynamic
Case 1.6 — Deep-link + OldRoutes redirect (non-edit) 1 6-1-before-oldurl-nonedit 1 6-2-entry-redirected-nonedit
Case 2.1 — Confirmation → edit Time (forward) 2 1-1-before-confirmation 2 1-2-entry-time-edit
Case 2.2 — Edit save → back to Confirmation 2 2-1-before-time-edit 2 2-2-entry-confirmation-updated
Case 2.3 — Edit back button 2 3-1-before-time-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

…rt 2)

Migrate MONEY_REQUEST_STEP_TIME (path `time`, entry STEP_DESTINATION +
MONEY_REQUEST.CREATE) and MONEY_REQUEST_STEP_TIME_EDIT (path `time-edit`,
entry STEP_CONFIRMATION) to dynamic routes, removing their static routes
and the `backTo` param.

- Rename IOURequestStepTime -> DynamicIOURequestStepTime; edit mode from
  route.name, back path from useDynamicBackPath (replaces the reconstructed
  conditional back logic).
- Destination forward builds Time on the start base when opened inline on
  the start page (single per-diem policy) and on the destination base
  otherwise; subrate goBack and confirmation edit use createDynamicRoute.
- Add OldRoutes redirects + getMatchingNewRoute unit 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