fix: KYC flow doesn't trigger after adding bank account when paying another user#92154
fix: KYC flow doesn't trigger after adding bank account when paying another user#92154samranahm wants to merge 4 commits into
Conversation
|
@Eskalifer1 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] |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adjusts the personal bank account clearing logic so that, when entering the international deposit account flow, routing-related data is preserved while transient UI/error state is reset.
Changes:
- Added a
shouldPreserveRoutingDataparameter toclearPersonalBankAccountthat, when true, only clears loading/error/success flags instead of wiping the entire Onyx key. - Updated
AccountFlowEntryPointto callclearPersonalBankAccount(true)to retain routing data on mount.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/libs/actions/BankAccounts.ts | Adds optional preserve flag to selectively merge-clear transient state instead of nulling the whole bank account key. |
| src/pages/settings/Wallet/InternationalDepositAccount/subPages/AccountFlowEntryPoint.tsx | Passes true to preserve routing data when clearing on entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1e59aa03c
ℹ️ 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".
|
|
||
| useEffect(() => { | ||
| clearPersonalBankAccount(); | ||
| clearPersonalBankAccount(true); |
There was a problem hiding this comment.
Clear stale routing when entering the generic add-account flow
When this entry point is reached from a normal wallet add-bank-account action after the user previously abandoned a payment/KYC-driven add-bank flow, openPersonalBankAccountSetupView({}) does not clear PERSONAL_BANK_ACCOUNT, and this call now preserves the old onSuccessFallbackRoute/exitReportID. After the later wallet-initiated bank account succeeds, AddPersonalBankAccountPage.exitFlow(true) can continue the stale KYC/payment flow or dismiss to an old report instead of returning to the wallet. Preserve only routing data that was intentionally seeded for the current flow, or clear stale routing before this generic entry point is reused.
Useful? React with 👍 / 👎.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
| function clearPersonalBankAccount(shouldPreserveRoutingData = false) { | ||
| /** | ||
| * Clears personal bank account state. Pass `shouldPreserveAccountData=true` to only clear UI/error | ||
| * fields while keeping routing and context fields intact. | ||
| */ | ||
| function clearPersonalBankAccount(shouldPreserveAccountData = false) { | ||
| clearPlaid(); | ||
| if (shouldPreserveRoutingData) { | ||
| if (shouldPreserveAccountData) { |
There was a problem hiding this comment.
I don't think we should do it this way, because we currently have cleanup logic throughout the entire project, so I think we should keep it.
I think that when we added the cleanup logic, we simply forgot that onSuccessFallbackRoute shouldn’t be cleaned up, so I think we should just fix that. If we leave it as it is now, we’ll definitely get regressions and incorrect behavior.
I think it should look something like this:
function clearPersonalBankAccount(preservedData?: Partial<PersonalBankAccount>) {
clearPlaid();
Onyx.set(ONYXKEYS.PERSONAL_BANK_ACCOUNT, preservedData ?? null);
Onyx.set(ONYXKEYS.FORMS.PERSONAL_BANK_ACCOUNT_FORM_DRAFT, null);
clearPersonalBankAccountSetupType();
}And pass it like this:
useEffect(() => {
clearPersonalBankAccount(personalBankAccount?.onSuccessFallbackRoute ? {onSuccessFallbackRoute: personalBankAccount.onSuccessFallbackRoute} : undefined);
}, []);What do you think about that?
Explanation of Change
Fixed Issues
$ #91873
PROPOSAL: #91873 (comment)
Tests
Precondition:
Steps:
Offline tests
QA Steps
Same as test
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android.Native.mp4
Android: mWeb Chrome
Android.mWeb.Chrome.mp4
iOS: Native
IOS.Native.mp4
iOS: mWeb Safari
IOS.mWeb.Safari.mp4
MacOS: Chrome / Safari
macOS.Chrome.mp4