Skip to content

Migrate split expense routes to dynamic URL navigation - #98945

Merged
mjasikowski merged 4 commits into
Expensify:mainfrom
suneox:83853-migrate-money-request-part-6-part-2-suneox
Aug 21, 2026
Merged

mjasikowski merged 4 commits into
Expensify:mainfrom
suneox:83853-migrate-money-request-part-6-part-2-suneox

Conversation

@suneox

@suneox suneox commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Part 2 of #83853 migrates the split expense routes to dynamic URL navigation: SPLIT_EXPENSE → split-expense-overview, SPLIT_EXPENSE_SEARCH → split-expense-overview-search and SPLIT_EXPENSE_CREATE_DATE_RANGE → split-expense-create-date-range. The screen a flow was opened from now lives in the URL itself instead of a backTo param, which also retires the TODO: Remove backTo from route once we have find another way to fix navigation issues with tabs workaround: both overview routes keep hosting the amount/percentage/date tab navigator, and their tab paths stay nested under the dynamic pattern (no exact: true) because amount and date are not globally unique patterns on their own.

Fixed Issues

$ #83853
PROPOSAL:

Tests

Group 1 — MONEY_REQUEST_SPLIT_EXPENSE (split-expense-overview)

Case 1.1 — Entry via "Amount • Split" chip (edit mode)

Target: src/components/ReportActionItem/MoneyRequestView.tsx:1213

Precondition: A transaction thread whose expense is already split (≥ 2 split children) → split indicator shows on the Amount row.

Steps:

  1. Open the app, go to a workspace report containing a split expense.
  2. Open the transaction thread of a split child (tap the expense row).
  3. Tap the Amount chip (labeled "Amount • Split, ").
  4. Verify the Split overview opens; URL = /<base>/split-expense-overview?splitReportID=<id>&transactionID=<id>&splitExpenseTransactionID=<id>; no backTo added by the dynamic route.
  5. Verify edit mode renders (member rows, no tab bar for existing splits).

Expected: Suffix + all three query params present; no NotFound.

Case 1.2 — Entry via header ⋮ menu → Split

Target: src/components/MoneyRequestHeaderSecondaryActions.tsx:397

Precondition: Open expense report with exactly 1 splittable expense; user is submitter; policy expense chat enabled.

Steps:

  1. Open the transaction thread of the expense.
  2. Tap ⋮ (More) in the header → Split.
  3. Verify URL = <base>/split-expense-overview/amount?splitReportID=…&transactionID=… (initial-split mode includes the tab segment).

Expected: Split overview renders, correct suffix + query, no backTo added by the route.

Case 1.3 — Back from overview

Steps: From the overview, tap Back (←). Verify it returns to the source screen with suffix + dynamic query params stripped cleanly.

Case 1.4 — Refresh restores overview + active tab

Steps: Switch to the Percentage tab (URL gains /percentage) → F5 → verify the overview restores with Percentage tab active → Back returns to the source screen.

Case 1.5 — Tab switch updates URL segments

Steps: Switch Amount → Percentage → Date. Verify each tab corresponds to a URL segment (/percentage, /date), query params preserved, and switching tabs does not pop the screen (back stack intact).

Case 1.6 — Cold deep-link in a new tab

Steps: Paste the overview URL (with /percentage) into a new tab → verify it boots straight into the Split overview with the right tab, no NotFound, and Back goes to the source screen.

Case 1.7 — Row tap → SPLIT_EXPENSE_EDIT → back to dynamic overview

Target: src/pages/iou/DynamicSplitExpensePage.tsx:624

Precondition: An existing split (overview in edit mode with rows).

Steps:

  1. On the overview, tap a split row.
  2. Verify the static edit route opens: /edit/split-expense/overview/...?backTo=<encoded dynamic overview URL>.
  3. Tap Back on the edit page.
  4. Verify it returns to the dynamic overview (full URL incl. splitExpenseTransactionID).

Case 1.8 — Delete-last-child redirect into edit flow

Target: src/libs/actions/SplitExpenses.ts:130

Precondition: ⚠️ Redirect only triggers for per-diem split sources (guard shouldRedirectDeleteToSplitExpenseEdit requires isPerDiemRequest). Split a per-diem expense first.

Steps:

  1. Delete one split child (via report details) leaving the last one → app redirects into the edit flow.
  2. Verify the edit URL's backTo decodes to the dynamic overview URL (…/split-expense-overview?splitReportID=…&transactionID=…), not the legacy static path.
  3. Back/Save returns to the dynamic overview.

Case 1.9 — Legacy overview URL → NotFound

Steps: Navigate to /create/split-expense/overview/<reportID>/<transactionID>/<splitTxnID>/<backTo> → verify graceful "Oops, this page cannot be found" + "Go back to home page" (accepted regression; no redirect added in this PR).

Group 2 — MONEY_REQUEST_SPLIT_EXPENSE_SEARCH (split-expense-overview-search)

Case 2.1 — Entry via Search bulk action

Target: src/hooks/useSearchBulkActions.ts:2575

Steps:

  1. Open Search, run an expense query.
  2. Tick exactly 1 splittable expense → tap the "1 selected" pill → Split.
  3. Verify URL = /search/split-expense-overview-search/amount?q=<search query>&splitReportID=…&transactionID=… (search query q preserved, -search suffix variant).

Case 2.2 — Back → Search

Steps: From the search overview, tap Back → verify return to /search?q=… with the query intact and suffix stripped.

Case 2.3 — Refresh

Steps: F5 on the search overview URL → verify it restores without NotFound.

Case 2.4 — Base /search/r/<reportID> (search report RHP)

Steps: Open a report RHP from Search (/search/r/<id>), open a transaction thread, ⋮ → Split → verify /search/r/<id>/split-expense-overview-search/… opens and Back returns to /search/r/<id>.

Group 3 — MONEY_REQUEST_SPLIT_EXPENSE_CREATE_DATE_RANGE (split-expense-create-date-range)

Case 3.1 — Entry via "Split dates" row

Target: src/pages/iou/DynamicSplitExpensePage.tsx:580

Steps: On the overview (Date tab), tap "Split dates" → verify the URL appends /split-expense-create-date-range to the overview URL (tab segment included) and the query params are inherited (the route declares no query params of its own).

Case 3.2 — Save/Back → overview

Steps: Set start/end dates, Save (or Back) → verify return to the dynamic overview with the child suffix stripped.

Case 3.3 — Refresh on date-range URL

Steps: F5 on the date-range URL → verify both layers restore (overview + date-range page), no NotFound.

  • Verify that no errors appear in the JS console

Offline tests

  • Same as tests.

QA Steps

Test case 1: Split an expense from its transaction thread

  1. Sign in and open a workspace expense report that is not submitted yet and contains exactly one expense with an amount.
  2. Tap the expense to open its transaction thread.
  3. Tap ⋮ (More) in the header → Split.
  4. Verify the Split page opens with the Amount / Percentage / Date tabs, and the URL ends with /split-expense-overview/amount?splitReportID=…&transactionID=… (no backTo is added).
  5. Tap the Percentage tab, then the Date tab, and verify the last URL segment follows the selected tab each time.
  6. Tap the ← back button and verify you land back on the transaction thread you started from

Test case 2: Pick a split date range

  1. Follow Test case 1 to open the Split page, then tap the Date tab.
  2. Tap the Split dates row.
  3. Verify the Split dates page opens with Start date and End date fields and the URL appends /split-expense-create-date-range to the overview URL, without adding new query params.
  4. Set Start date to today and End date to today + 2 days, then tap Save.
  5. Verify you land back on the Split page on the Date tab with the splits regenerated across the three days.
  6. Tap the ← back button and verify you land back on the transaction thread.

Test case 3: Split an expense from Search

  1. Tap the Search tab and run an expense query.
  2. Tick exactly one splittable expense → tap the "1 selected" pill → Split.
  3. Verify the Split page opens and the URL ends with /split-expense-overview-search/amount?q=<search query>&splitReportID=…&transactionID=…, with the search query preserved.
  4. Tap the ← back button and verify you land back on Search with the same query and filters.
  • 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
CleanShot.2026-08-21.at.11.10.51.1.mp4

Sync main

CleanShot.2026-08-21.at.11.41.26.1.mp4
Case 1.1 — Entry via "Amount • Split" chip (edit mode) 1 1-1-before-child-txn-thread-split-indicator 1 1-2-entry-overview-edit-mode-via-split-indicator
Case 1.2 — Entry via header ⋮ menu → Split 1 2-1-before-txn-thread-source 1 2-2-entry-split-expense-overview-amount
Case 1.3 — Back from overview 1 3-3-after-back-overview-back-to-child-txn-thread
Case 1.4 — Refresh restores overview + active tab 1 4-2-entry-percentage-refresh-restored 1 4-3-after-back-back-to-txn-thread-after-refresh
Case 1.5 — Tab switch updates URL segments 1 5-2-entry-date-tab-url 1 5-2-entry-percentage-tab-url
Case 1.6 — Cold deep-link in a new tab 1 6-2-entry-cold-deeplink-percentage-restored 1 6-3-after-back-cold-deeplink-back-to-txn-thread
Case 1.7 — Row tap → SPLIT_EXPENSE_EDIT → back to dynamic overview 1 7-1-before-overview-amounts-filled-pre-save 1 7-1-before-overview-edit-mode-rows 1 7-2-entry-split-expense-edit-static-route 1 7-3-after-back-edit-back-to-dynamic-overview
Case 1.8 — Delete-last-child redirect into edit flow 1 8-1-before-edit-page-before-remove-split 1 8-1-before-perdiem-split-child-before-delete 1 8-1-before-split-child-thread-before-delete 1 8-2-entry-delete-redirect-edit-backto-dynamic-overview
Case 1.9 — Legacy overview URL → NotFound

Not support

Case 2.1 — Entry via Search bulk action 2 1-1-before-search-page-before-bulk-split 2 1-2-entry-search-bulk-split-overview-search-suffix
Case 2.2 — Back → Search 2 2-3-after-back-back-to-search-with-query
Case 2.3 — Refresh 2 3-2-entry-search-overview-refresh-restored
Case 2.4 — Base `/search/r/` (search report RHP)
Case 3.1 — Entry via "Split dates" row 3 1-1-before-split-overview-date-tab-source 3 1-2-entry-create-date-range-inherited-params
Case 3.2 — Save/Back → overview 3 2-3-after-back-back-to-split-overview
Case 3.3 — Refresh on date-range URL 3 3-2-entry-date-range-refresh-restored

@suneox
suneox requested review from a team as code owners August 19, 2026 05:25
@melvin-bot
melvin-bot Bot requested review from dylanexpensify and huult and removed request for a team August 19, 2026 05:25
@melvin-bot

melvin-bot Bot commented Aug 19, 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 August 19, 2026 05:25
@suneox
suneox marked this pull request as draft August 19, 2026 05:26
@codecov

codecov Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/SCREENS.ts 100.00% <ø> (ø)
...libs/Navigation/helpers/getAdaptedStateFromPath.ts 56.41% <100.00%> (-1.26%) ⬇️
...avigation/linkingConfig/RELATIONS/SEARCH_TO_RHP.ts 100.00% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 66.66% <ø> (ø)
src/pages/iou/SplitExpenseEditPage.tsx 0.00% <0.00%> (ø)
src/ROUTES.ts 26.31% <75.00%> (+0.40%) ⬆️
...gation/AppNavigator/ModalStackNavigators/index.tsx 6.33% <0.00%> (ø)
...ges/iou/DynamicSplitExpenseCreateDateRangePage.tsx 0.00% <0.00%> (ø)
src/libs/actions/SplitExpenses.ts 88.09% <33.33%> (ø)
src/pages/iou/DynamicSplitExpensePage.tsx 0.00% <0.00%> (ø)
... and 10 files with indirect coverage changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f68c475c1e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/ROUTES.ts Resolved
@suneox
suneox marked this pull request as ready for review August 21, 2026 04:20
@huult

huult commented Aug 21, 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-08-21.at.13.08.43.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 August 21, 2026 06:12
@mjasikowski
mjasikowski merged commit 14fd1c1 into Expensify:main Aug 21, 2026
37 of 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 OSBotify mentioned this pull request Aug 22, 2026
61 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

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

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

@MelvinBot

Copy link
Copy Markdown
Contributor

Help site review — no changes required

I reviewed the changes in this PR against Expensify's help site files under App/docs/articles (specifically Split-Expenses.md, the article covering this feature) and no help site changes are required.

Why: This PR is an internal navigation refactor. It migrates the split expense routes to dynamic URL navigation (SPLIT_EXPENSE → split-expense-overview, etc.), moves the source screen into the URL instead of a backTo param, and updates the linking/route config. None of this changes any user-facing behavior, UI labels, tab names, or copy:

  • The split flow is still More > Split, with the Amount / Percentage / Date tabs and the same split table.
  • No new screens, buttons, or settings were added.
  • The help article documents the user flow, not internal URL/route structure — which is what changed here.

Since no user-facing behavior changed, no draft docs PR was created (and there is therefore no linked help site PR to review).


view run

@jponikarchuk

Copy link
Copy Markdown

Unable to search the PR Culprit for this Deploy Blocker issue #99265 because of deeplink navigation issue on Ad-hoc build. Could you please double check if it's not introduced #98945

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 9.4.59-5 🚀

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

Bundle Size Analysis (Sentry):

@mjasikowski

Copy link
Copy Markdown
Contributor

ping @suneox for comment: #98945 (comment)

@suneox

suneox commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Unable to search the PR Culprit for this Deploy Blocker issue #99265 because of deeplink navigation issue on Ad-hoc build. Could you please double check if it's not introduced #98945

@jponikarchuk Issue #99265 was not introduced by this PR and has already been resolved by this PR

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