Skip to content

feat: Refator USD flow to use useSubPage#90302

Merged
arosiclair merged 11 commits into
Expensify:mainfrom
callstack-internal:feat/79048-restore
May 27, 2026
Merged

feat: Refator USD flow to use useSubPage#90302
arosiclair merged 11 commits into
Expensify:mainfrom
callstack-internal:feat/79048-restore

Conversation

@MrMuzyk
Copy link
Copy Markdown
Contributor

@MrMuzyk MrMuzyk commented May 12, 2026

Explanation of Change

Restores reverted #88193 together with fixes for newly found bugs

Fixed Issues

$ #79048
PROPOSAL:

Tests

Same as QA steps +

Scenario A:

  1. Create a USD workspace
  2. Go to Workflow
  3. Add bank account
  4. Finish the Add BA flow and reach the success modal
  5. Click device back button (swipe back on mobile)
  6. Try resubmitting final step again
  7. API call passes correctly

Scenario B:

  1. Go to Wallet
  2. Click Add bank account
  3. On the Bank Purpose Page choose Make Payments
  4. Choose United States
  5. Go through the flow until confirmation page
  6. Click browser back button to go back to date of birth step
  7. Click browser forward button a few times
  8. The date picker closes as the next step does not require it.

Scenario C:

  1. Go to Workspace > Workflows
  2. Click Add bank account
  3. Proceed with the flow of adding Plaid 1111 BA
  4. On the Company Tax ID Number page enter one wrong digit like "123455789"
  5. On the final page click "Save and continue"
  6. Click "Update details" on the "Let's finish in chat!" RHP
  7. User is navigated to the Personal info RHP
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Prerequisites: being an admin of at least one workspace, the workspace tested should have USD as the workspace currency

  1. Go to Workspace > Workflows
  2. Click Add bank account
  3. Verify that the Country and Currency is filled in with
  4. Go through the flow, fill in all the fields
  5. Click browser / native back button
  6. Verify that you're redirected to the previous step, not out of the flow
  7. Go to Wallet
  8. Click Add bank account
  9. On the Bank Purpose Page choose Make Payments
  10. Choose United States
  11. Repeat steps 4-6 from the previous scenario
  12. Go through the whole flow - verify that you can add the bank account both in the Wallet and in the Workflows

Partially setup bank accounts

  1. Start adding the bank account in the wallet
  2. Leave the flow in the middle (on any step after Bank Info)
  3. Verify that the account is added with a "Action required" badge
  4. Click this account
  5. Verify that the proper major step opens
  6. Go back and forth a few steps
  7. Verify that the navigation between the steps works as expected
  • 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 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.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios-native.mp4
iOS: mWeb Safari
ios-web.mp4
MacOS: Chrome / Safari
web.mp4

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 93.84% <ø> (ø)
src/SCREENS.ts 100.00% <ø> (ø)
src/components/DatePicker/index.tsx 0.00% <ø> (ø)
src/components/Modal/internalPopstateGuard.ts 100.00% <100.00%> (ø)
src/libs/Navigation/linkingConfig/config.ts 76.92% <ø> (ø)
src/libs/ReimbursementAccountUtils.ts 92.30% <ø> (+34.24%) ⬆️
...ctions/ReimbursementAccount/resetUSDBankAccount.ts 61.53% <ø> (ø)
...mbursementAccount/ConnectedVerifiedBankAccount.tsx 0.00% <ø> (ø)
...tAccount/ReimbursementAccountVerifyAccountPage.tsx 0.00% <ø> (ø)
.../BeneficialOwnerDetailsFormSubSteps/AddressUBO.tsx 0.00% <ø> (ø)
... and 48 more
... and 85 files with indirect coverage changes

@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 14, 2026

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@MrMuzyk MrMuzyk marked this pull request as ready for review May 15, 2026 11:23
@MrMuzyk MrMuzyk requested review from a team as code owners May 15, 2026 11:23
@melvin-bot melvin-bot Bot requested review from dukenv0307 and flaviadefaria and removed request for a team and dukenv0307 May 15, 2026 11:23
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 15, 2026

@dukenv0307 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 May 15, 2026 11:23
Copy link
Copy Markdown

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

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: b6d3e94ddb

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

(onfidoData: OnfidoData) => {
verifyIdentityForBankAccount(Number(bankAccountID), {...onfidoData, applicantID: onfidoApplicantID}, policyID);
updateReimbursementAccountDraft({isOnfidoSetupComplete: true});
onSubmit?.();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Wait for Onfido verification write before advancing flow

Calling onSubmit immediately in handleOnfidoSuccess advances to the Company step before verifyIdentityForBankAccount finishes, so a failed/slow API write (e.g., offline or backend error) can still move the user forward with identity verification not actually persisted. Previously this step transition was gated by the backend-updated reimbursement state; this change removes that guard and can leave users in later steps with an invalid verification state.

Useful? React with 👍 / 👎.

@flaviadefaria
Copy link
Copy Markdown
Contributor

No new product considerations - removing my assignment and unsubscribing.

@flaviadefaria flaviadefaria removed their request for review May 15, 2026 12:09
@dukenv0307
Copy link
Copy Markdown
Contributor

I'll review it. don't know why Melvin removed me

@dukenv0307
Copy link
Copy Markdown
Contributor

on it now

@dukenv0307
Copy link
Copy Markdown
Contributor

  1. in the What's your company’s incorporation date? step
  2. Open the year modal
  3. Select any year
  4. Observe that the date picker disappears
Screen.Recording.2026-05-19.at.09.22.59.mov

@dukenv0307
Copy link
Copy Markdown
Contributor

dukenv0307 commented May 19, 2026

Looks good

Screen.Recording.2026-05-19.at.09.37.32.mov

@MrMuzyk
Copy link
Copy Markdown
Contributor Author

MrMuzyk commented May 19, 2026

in the What's your company’s incorporation date? step
Open the year modal
Select any year
Observe that the date picker disappears

Found the root cause, working on a fix right now

@MrMuzyk
Copy link
Copy Markdown
Contributor Author

MrMuzyk commented May 19, 2026

@dukenv0307 I've fixed the error you've spotted and lint issue. Should be good to review further

@dukenv0307
Copy link
Copy Markdown
Contributor

@MrMuzyk I can still reproduce the date picker issue on Safari

Screen.Recording.2026-05-19.at.23.17.03.mov

@MrMuzyk
Copy link
Copy Markdown
Contributor Author

MrMuzyk commented May 19, 2026

Let me double check 🤔

@MrMuzyk
Copy link
Copy Markdown
Contributor Author

MrMuzyk commented May 19, 2026

I think the page is having some issues right now so I'll get back to it tomorrow morning

@MrMuzyk
Copy link
Copy Markdown
Contributor Author

MrMuzyk commented May 20, 2026

I wasn't able to fix it and Im not sure whether we want to spend more time on it now. While it is poor UX and should be fixed it is only under very specific condition on a single platform. It doesn't block user from interacting with the app and modal still can be closed if you click anywhere outside of it.

In order to fix it on all other platforms I've used existing mechanism that was already implemented but not in use for this component - shouldCloseWhenBrowserNavigationChanged prop.

Im almost certain that the same bug can be reproduced in other places that use this prop.

@arosiclair Could we maybe give it the same treatment as we did with flicker bug? Open a separate issue for it and revisit it later?

@arosiclair
Copy link
Copy Markdown
Contributor

Yeah I think that makes sense since the bug is not critical - it only occurs on mWeb Safari and you can just dismiss the popup when it happens. Made an issue here: #91311

@MrMuzyk
Copy link
Copy Markdown
Contributor Author

MrMuzyk commented May 21, 2026

@dukenv0307 Did everything else work fine?

@dukenv0307
Copy link
Copy Markdown
Contributor

on it now

@melvin-bot melvin-bot Bot requested a review from arosiclair May 21, 2026 15:16
@github-actions
Copy link
Copy Markdown
Contributor

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

@github-actions

This comment has been minimized.

@arosiclair
Copy link
Copy Markdown
Contributor

I requested ad-hoc testing from QA here

@dukenv0307
Copy link
Copy Markdown
Contributor

dukenv0307 commented May 22, 2026

@MrMuzyk There are some conflicts, can you please take a look?

@MrMuzyk
Copy link
Copy Markdown
Contributor Author

MrMuzyk commented May 22, 2026

@MrMuzyk There are some conflicts, can you please take a look?

Will do soon

@MrMuzyk
Copy link
Copy Markdown
Contributor Author

MrMuzyk commented May 25, 2026

I requested ad-hoc testing from QA here

@arosiclair Hi, how is the testing going?

@arosiclair
Copy link
Copy Markdown
Contributor

No update yet. I just bumped them

@MrMuzyk
Copy link
Copy Markdown
Contributor Author

MrMuzyk commented May 25, 2026

FYI Im off tomorrow so will get back to it on wednesday

@IuliiaHerets
Copy link
Copy Markdown

Regression is completed, and no issues were found.

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.

Can we add docs to both of these functions that explain what we can use this for?


type Screens = Partial<Record<Screen, () => React.ComponentType>>;

// Reimbursement Account flow animations glitch on low-end Android devices in Chrome mWeb https://github.com/Expensify/App/issues/87658 so we intentionally disable them
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.

Suggested change
// Reimbursement Account flow animations glitch on low-end Android devices in Chrome mWeb https://github.com/Expensify/App/issues/87658 so we intentionally disable them

Let's move this down to the disabling line

[SCREENS.TWO_FACTOR_AUTH.SUCCESS]: {
animationTypeForReplace: 'push',
},
...(IS_MOBILE_CHROME ? Object.fromEntries(REIMBURSEMENT_ACCOUNT_FLOW_SCREENS.map((screen) => [screen, {animation: Animations.NONE}])) : {}),
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.

Suggested change
...(IS_MOBILE_CHROME ? Object.fromEntries(REIMBURSEMENT_ACCOUNT_FLOW_SCREENS.map((screen) => [screen, {animation: Animations.NONE}])) : {}),
// Reimbursement Account flow animations show glitches on low-end Android devices in Chrome mWeb so we intentionally disable them here.
// See https://github.com/Expensify/App/issues/89915
...(IS_MOBILE_CHROME ? Object.fromEntries(REIMBURSEMENT_ACCOUNT_FLOW_SCREENS.map((screen) => [screen, {animation: Animations.NONE}])) : {}),

Comment on lines +62 to +75
// After a disconnect, wait for the reset API to finish before navigating to the entry point.
const prevPendingActionRef = useRef(pendingAction);
useEffect(() => {
const prev = prevPendingActionRef.current;
prevPendingActionRef.current = pendingAction;
if (prev === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID, backTo}));
}
}, [pendingAction, policyID, backTo]);

// While the disconnect is in flight, show the existing flow loader so the success screen doesn't re-render with cleared bank data
if (pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
return <ReimbursementAccountLoadingIndicator onBackButtonPress={onBackButtonPress} />;
}
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.

I'm a bit confused by this code. What scenario is this handling?

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.

When user connected the account and decided to immediately disconnected it. This case stopped working after our refactor and while QAs didnt yet find it I did when testing and fixed it

@MrMuzyk MrMuzyk force-pushed the feat/79048-restore branch from 0930dbb to e9a2719 Compare May 27, 2026 11:26
@MrMuzyk MrMuzyk requested a review from arosiclair May 27, 2026 11:53
@arosiclair arosiclair merged commit af2710c into Expensify:main May 27, 2026
34 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🚧 @arosiclair 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.

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