Skip to content

Migrate First verify-account Route (BATCH-5) - #81413

Merged
14 commits merged into
Expensify:mainfrom
software-mansion-labs:collectioneur/dynamic-routes-batch-5
Feb 24, 2026
Merged

14 commits merged into
Expensify:mainfrom
software-mansion-labs:collectioneur/dynamic-routes-batch-5

Conversation

@collectioneur

@collectioneur collectioneur commented Feb 4, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

I refactored the first page from a static to a dynamic route. ROUTES.SETTINGS_WALLET_VERIFY_ACCOUNT now uses dynamic route logic.

Fixed Issues

$ #80910

Tests

Prerequisites:

  1. Open the app and create a fresh account.
  2. Do not verify your email during the onboarding process.
  3. Go to Account -> Wallet.

Test 1

  1. Click "Enable wallet".
  2. Verify that the "verify-account" modal appears. Check that the URL has no backTo or forwardTo parameters.

Test 2

  1. Dismiss the modal.
  2. Verify that the app navigates back to settings/wallet.

Test 3

  1. Click "Enable wallet".
  2. Enter the verification code.
  3. Verify that the app navigates to settings/wallet/enable-payments.

Test 4

  1. Click "Enable wallet".
  2. Refresh the page.
  3. Verify that the page loads correctly with the correct background. Ensure that back/forward navigation paths remain the same as before the refresh.

Test 5

  1. Click "Enable wallet".
  2. Open via deep link (or access directly via URL) and verify the behavior matches the previous step.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Same as tests

  • 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 verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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
Screen.Recording.2026-02-04.at.16.35.12.mov

@codecov

codecov Bot commented Feb 4, 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/ROUTES.ts 13.78% <ø> (+0.09%) ⬆️
src/SCREENS.ts 100.00% <ø> (ø)
...gation/AppNavigator/ModalStackNavigators/index.tsx 7.46% <ø> (+0.01%) ⬆️
...c/libs/Navigation/helpers/getLastSuffixFromPath.ts 71.42% <100.00%> (-3.58%) ⬇️
src/libs/Navigation/helpers/getPathFromState.ts 85.71% <100.00%> (+4.46%) ⬆️
src/libs/Navigation/helpers/splitPathAndQuery.ts 100.00% <100.00%> (+100.00%) ⬆️
...igation/linkingConfig/RELATIONS/SETTINGS_TO_RHP.ts 100.00% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 75.00% <ø> (ø)
src/pages/settings/Wallet/WalletPage/index.tsx 0.00% <ø> (ø)
src/pages/settings/DynamicVerifyAccountPage.tsx 0.00% <0.00%> (ø)
... and 7 files with indirect coverage changes

@collectioneur
collectioneur marked this pull request as ready for review February 10, 2026 13:01
@collectioneur
collectioneur requested review from a team as code owners February 10, 2026 13:01
@melvin-bot
melvin-bot Bot requested review from heyjennahay and mananjadhav and removed request for a team February 10, 2026 13:01
@melvin-bot

melvin-bot Bot commented Feb 10, 2026

Copy link
Copy Markdown

@mananjadhav 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 February 10, 2026 13:01
Comment thread src/libs/Navigation/types.ts Resolved

@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: 177d5b5b29

ℹ️ 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".

@mjasikowski
mjasikowski removed the request for review from heyjennahay February 10, 2026 13:27
@mjasikowski mjasikowski changed the title Migrate First verify-account Route (BATCH-5) [NoQA] Migrate First verify-account Route (BATCH-5) Feb 10, 2026
@mjasikowski mjasikowski changed the title [NoQA] Migrate First verify-account Route (BATCH-5) Migrate First verify-account Route (BATCH-5) Feb 10, 2026
@mananjadhav

Copy link
Copy Markdown
Collaborator

I am reviewing #81859 instead of this one.

@mananjadhav mananjadhav left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@collectioneur I've posted some comments. Also some general aspects of the dynamic routes to be addressed/clarified:

  • Dynamic suffix must be last segment
  • Only one dynamic suffix allowed
  • No nested dynamic routes
  • Too many type cases, example as Route, as Screen, etc.

@@ -0,0 +1,22 @@
import React from 'react';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need to add a new page prefixing Dynamic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think, that's a great way to clearly distinguish between static and dynamic pages, I’ll update the documentation to include this context. As a follow-up I’m also planning to add an ESLint rule to help validate these naming conventions for dynamic screens and components 😄

if (!pathWithoutParams) {
throw new Error('[getLastSuffixFromPath.ts] Failed to parse the path, path is empty');
if (!normalizedPath) {
Log.warn('[getLastSuffixFromPath.ts] Failed to parse the path, path is empty');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question: We changed the error to warn and now returning ''. Are we sure it won't cause regression elsewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This should be safe from regressions. Since we verify that the path exists before calling this function, that if statement is effectively unreachable. It was added primarily to satisfy TypeScript/ESLint requirements

* @param dynamicRouteSuffix The dynamic route suffix to remove from the current path
* @returns The back path without the dynamic route suffix, or HOME if path is null/undefined
*/
function useDynamicBackPath(dynamicRouteSuffix: DynamicRouteSuffix): Route {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question: Are we planning on adding tests for the same?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I can see the tests are added in the next PR #81859 (review)

* @returns A tuple where the first element is the path without trailing slash
* and the second element is the query string (if any).
*/
function splitPathAndQuery(fullPath: string | undefined): [string | undefined, string | undefined] {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it's best we add some unit tests for the same.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I can see the tests are added in the next PR #81859 (review)

@@ -0,0 +1,13 @@
/**
* Splits a full path into its path and query components.
* @param fullPath - The full URL path (e.g., '/settings/wallet?param=value')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question: The example uses fullPath but when calling inside useDynamicBackPath we use pathWithoutLeadingSlash. Any reason we're not passing the full path?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great catch. We don't need to explicitly remove trailing slashes in useDynamicBackPath, as that logic is already handled in splitPathAndQuery. I'll clean that up in the next commit, thanks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the confusion! I re-checked the implementation and realized that removing the leading slash is actually necessary. Our route names don't include it, so we need that normalization to ensure the comparison logic works correctly in src/pages/settings/DynamicVerifyAccountPage.tsx. I'll leave that part as is 🙂


type State = NavigationState | Omit<PartialState<NavigationState>, 'stale'>;

const dynamicRouteEntries = Object.values(DYNAMIC_ROUTES);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question: Do you think using Set makes more sense? We're looping for every call in isDynamicRouteScreen?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Switching to a Set is a smart optimization for the future, even though we currently don't have many dynamic routes. I'll update the function. Thanks for the suggestion! 👍

const screenName = focusedRoute?.name ?? '';

// Handle dynamic route screens that require special path that is placed in state
if (isDynamicRouteScreen(screenName as Screen) && focusedRoute?.path) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we need to type case as Screen? Does it make sense to pass string and then typecase in the method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In this case, normalizedConfigs requires the Screen type. Because of that dependency, the type assertion was needed to keep the types aligned for now. I plan to come back to this later, ideally, a future refactor will allow us to streamline the types and remove these assertions where they aren't strictly necessary 👍

}

// If suffix is not the last segment, return the original path
return pathWithoutLeadingSlash as Route;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question: If Route expects paths like /settings/wallet, this would produce settings/wallet right? Could this break something in navigation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This hook is used only in dynamic components, so the fallback logic shouldn't be triggered. We should be safe from regressions here


const [normalizedPath, query] = splitPathAndQuery(pathWithoutLeadingSlash);

if (normalizedPath?.endsWith(`/${dynamicRouteSuffix}`)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we have any scenarios in future where we've got nested routes? Something like /settings/wallet/verify-account/step-2? Will it still work the same way as it's defined now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right, those cases aren't covered yet. I've flagged this in the Batch 7 docs, as we prioritized the base logic for this first release. We'll be rolling out support for those edge cases during phase 2 as the need arises

}

// Handle dynamic routes: find the appropriate full screen route
if (route.path) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion: I reviewed this in the previous PR but now that we're moving it around in the code base, do you think it makes sense to move it to a separate helper method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’ve adjusted the placement of that logic to ensure dynamic routes maintain the lowest priority for full screen lookups. Given that this is currently the only instance of this code, I’ve kept it inline rather than creating a separate helper method to keep things concise 👍

@collectioneur

Copy link
Copy Markdown
Contributor Author

@mananjadhav I’ve addressed all the comments and pushed the updates ✅ . Feel free to take another look whenever you have a moment

@collectioneur

Copy link
Copy Markdown
Contributor Author

@collectioneur I've posted some comments. Also some general aspects of the dynamic routes to be addressed/clarified:

  • Dynamic suffix must be last segment
  • Only one dynamic suffix allowed
  • No nested dynamic routes
  1. Last segment: Correct. The dynamic suffix is designed to always be the final segment in the path.
  2. Single suffix: You're right. At this stage, only one dynamic suffix is supported. We've planned the logic for multiple suffixes as a future enhancement once the specific need arises.
  3. Nested routes: Currently, nested dynamic routes are not supported. This will be implemented in Phase 2.

I've made sure the documentation reflects these current constraints to keep everything aligned 😄

@mjasikowski mjasikowski closed this pull request by merging all changes into Expensify:main in 5b4e825 Feb 24, 2026
@mananjadhav

Copy link
Copy Markdown
Collaborator

Screenshots/Videos

Android: HybridApp
android-dynamic-route-verify-account.mov
Android: mWeb Chrome
mweb-chrome-dynamic-route-verify-account.mov
iOS: HybridApp
ios-dynamic-route-verify-account.mov
iOS: mWeb Safari
mweb-safari-dynamic-route-verify-account.mov
MacOS: Chrome / Safari
web-dynamic-route-verify-account.mov

@mananjadhav

Copy link
Copy Markdown
Collaborator

This was merged including another PR but screencasts were pending. Uploaded them.

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.

3 participants