Reuse the active workspace when adding a bank account to pay an invoice as a business#97047
Draft
wildan-m wants to merge 4 commits into
Draft
Conversation
…e-add-bank-account-duplicate-workspace
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.
Explanation of Change
When paying an invoice as a business, the "Add bank account" option resolves which workspace the bank account should be attached to. For an individual invoice receiver it reuses the active workspace only when that workspace is one the user administers and its currency is already supported for direct reimbursement — and only US dollars qualify. A payer whose workspace is in any other currency therefore fails the reuse check on every attempt, so a brand new workspace is minted each time and the account fills up with duplicates. The first press makes matters worse rather than better: the workspace it creates takes the payer's local currency, becomes the active one, and then sends the user into the currency setup screen, so the very next press hits the same failing check again and loops.
The currency check does not belong in the reuse-or-create decision. Whether a workspace is already in a supported currency governs whether direct reimbursement can be offered, not whether an in-progress workspace should be abandoned — the screen the user lands on next exists precisely to finish configuring it. Basing the decision on administration rights alone is strictly broader than the previous condition, since the old one already implied it, so every case that reused a workspace before still reuses the same one; only the looping path changes. Visibility of the option is untouched and continues to use the currency check.
Fixed Issues
$ #92859
PROPOSAL: #92859 (comment)
Tests
Offline tests
Same as tests. This change only alters which existing workspace ID is chosen before navigating, so there is no new network request and no new offline behavior. Reusing a workspace avoids the workspace-creation write entirely, so the offline path performs strictly less optimistic work than before.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari