Surface duplicate Plaid bank account error on USD VBBA flow#91491
Open
Abdulloh0109 wants to merge 1 commit into
Open
Surface duplicate Plaid bank account error on USD VBBA flow#91491Abdulloh0109 wants to merge 1 commit into
Abdulloh0109 wants to merge 1 commit into
Conversation
The page-level effect listed reimbursementAccount?.isLoading in its deps and unconditionally called hideBankAccountErrors() whenever the user was on the Plaid sub-step. When the backend duplicate-account error landed, isLoading flipped true → false, the effect re-ran on the same step, and the fresh error was wiped before AddPlaidBankAccount could render it, making Next look unresponsive on re-selecting an existing Plaid account. Gate the clear to actual step transitions via usePrevious on currentStep and achData?.subStep. Because this codebase's usePrevious initializes its ref with the current value (rather than undefined), also track the first render with isFirstRenderRef so the initial mount on the Plaid sub-step (e.g. page reload, deeplink) still clears truly stale errors from a prior session. Fixes Expensify#89064
Contributor
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-05-23.at.18.01.32.mov |
Contributor
|
@Abdulloh0109 Couple of issues that need addressed on your side before I can complete the PR review:
Please tag me once these are completed so I can finalize PR review 🙌 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title
Fix duplicate Plaid bank account error not surfacing on USD VBBA flow
Body (to'liq markdown)
Explanation of Change
On Workspace → Workflows → Payments, when an admin adds a Plaid bank account, disconnects it, then re-runs Add bank account → Log into your bank and re-selects the same Plaid account, tapping Next previously did nothing visible — no error, no toast, no advance.
The page-level
useEffectinReimbursementAccountPage.tsxlistedreimbursementAccount?.isLoadingin its deps and unconditionally calledhideBankAccountErrors()whenever the user was on the Plaid sub-step. When the backend duplicate-account error landed,isLoadingflippedtrue → false, the effect re-ran on the same step, and the fresh error was wiped from Onyx beforeAddPlaidBankAccountcould render it via the existingFormAlertWithSubmitButton. Result: Next looked unresponsive on re-selecting an existing Plaid account.This change gates the clear to actual step transitions via
usePreviousoncurrentStepandachData?.subStep. Because this codebase'susePreviousinitializes its ref with the current value (rather thanundefined), the first render is also tracked withisFirstRenderRefso the initial mount on the Plaid sub-step (e.g. page reload, deeplink) still clears truly stale errors from a prior session — while fresh in-flight errors from a just-completed API call survive subsequentisLoadingtoggles.Per the issue's Implementation Note, only
ReimbursementAccountPage.tsxis modified — the existing error display path inAddPlaidBankAccount→FormAlertWithSubmitButtonis sufficient to render the error once the page-level wipe is gated.Fixed Issues
$ #89064
PROPOSAL: #89064 (comment)
Tests
user_good/pass_good).Offline tests
QA Steps
Same as Tests above.
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)mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
iOS: App
20260520_201235.mp4
Windows: Chrome
20260520_174644.mp4