You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-11-02] w37-Invoice-Default badge is missing and Make default payment method shown for Primary Default BA #101694
Precondition: Invoices is enable in Workspace and add a verified bank account in Invoices Bank account section
Navigate to Invoices > Bank Account section
Click on the three dot and verify that the "Make default payment method" option is completely hidden for one account.
Click on Add Bank Account and complete the plaid flow
After adding second BA, verify the primary bank account row displays a "Default" visual badge.
Result: Default badge is not displayed
Click on the three dot of Primary Default Acount
Verify that the "Make default payment method" option is hidden inside the three-dot menu for this primary default bank account row
Result: Make default option is shown for primary default account
Expected Result:
After adding second BA, the primary bank account row displays a "Default" visual badge and Make default option is not shown for primary default account
Actual Result:
After adding second BA, Default badge is not displayed and Make default option is shown for primary default account
Updated 2026-10-13: Corrected based on feedback from TaduJR and yuwenmemon.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After a workspace has two business bank accounts in Invoices > Bank account, no row shows the "Default" badge, and every row, including the primary one, offers "Make default payment method".
What is the root cause of that problem?
App treats an account as the invoice default only when policy.invoice.bankAccount.transferBankAccountID matches it (WorkspaceInvoiceVBASection.tsx:66). That saved ID often matches no eligible account, for two reasons:
It's never saved when an account is added.OpenPolicyInvoicesPage returns no transferBankAccountID before or after adding an account, so App falls back to 0.
It's kept after the account is deleted.TaduJR deleted the saved default on staging, and OpenPolicyInvoicesPage still returned the deleted ID.
What changes do you think we should make in order to solve the problem?
Fix it in App only. App saves nothing until the user presses "Make default".
In WorkspaceInvoiceVBASection, derive the invoice default:
Use the saved transferBankAccountID while it matches an eligible account.
Otherwise, use the first eligible account that isn't being deleted (its pendingAction isn't DELETE). This keeps the badge off a struck-through row that was deleted while offline.
Use the derived ID in two places:
To decide whether the selected row is the default (isSelectedPaymentMethodDefault), which hides "Make default" on that row.
As the invoiceTransferBankAccountID prop of PaymentMethodList (line 286), which shows the badge.
deletePaymentMethod should keep comparing against the saved ID. If it used the derived ID, deleting an unsaved derived default would save the next account with the deleted account as the rollback value. A failed request would then make the deleted account the saved default.
activePaymentMethodID has no effect in this section, because the section doesn't pass actionPaymentMethodType (PaymentMethodList.tsx:158-159).
In makeDefaultPaymentMethod, pass the saved transferBankAccountID as the rollback value instead of the Wallet's default account. Today a failed request puts the badge on the Wallet default, which has nothing to do with invoices. Keep the currentPaymentMethod lookup and the formatPaymentMethods import: paymentMethod.methodID is string | number, and setInvoicingTransferBankAccount needs a number.
Add UI tests to tests/ui/WorkspaceInvoiceVBASectionTest.tsx:
No saved default: the first eligible account shows the badge, and its menu offers Delete but not "Make default".
No saved default: the second account still offers "Make default".
No saved default, offline, with the first account being deleted: the badge moves to the second account.
A saved default on the second account: the badge follows it.
A saved default whose account was deleted: the first eligible account shows the badge, and its menu offers Delete but not "Make default".
"Make default" fails (the server answers with jsonCode 666): one request is sent, and the badge goes back to the saved default, not the Wallet default.
Open question: If invoice payouts go to the workspace's reimbursement account (policy.achAccount), step 1 should prefer that account, when it's eligible, over the first eligible account. An internal engineer needs to confirm this.
What alternative solutions did you explore? (Optional)
Save the default on the backend (this proposal's previous version). Rejected: yuwenmemon confirmed nothing on the server uses this value to move money. A backend save and backfill would store a value that only App reads.
Use the derived ID in deletePaymentMethod too. Rejected: a failed request can make the deleted account the saved default (see step 3).
Change only the falsy 0 check in PaymentMethodList.tsx:694. Rejected: no account matches 0 or a deleted ID, so the badge still doesn't show.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/101694#issuecomment-5757222080) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
In Workspace Settings > Invoices > Bank Account:
After adding a second verified business bank account, the primary (first) bank account does not display the "Default" visual badge, and opening the three-dot menu on the primary bank account unexpectedly shows the "Make default payment method" option.
What is the root cause of that problem?
There are two core root causes working together:
Unassigned Initial Invoicing Default in WorkspaceInvoiceVBASection.tsx:
In src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx (lines 64–72):
When a workspace connects business bank accounts, policy.invoice.bankAccount.transferBankAccountID is initially unset (undefined / 0). The backend and frontend expect the first eligible business bank account added to the workspace to act as the primary invoice default.
Because transferBankAccountID remains 0:
transferBankAccountID === methodID (line 110) evaluates to false for every bank account. Consequently, paymentMethod.isSelectedPaymentMethodDefault is always false.
As soon as a second bank account is added (hasMultipleEligibleBankAccounts becomes true), shouldShowMakeDefaultButton (line 72) evaluates to true for both bank accounts.
transferBankAccountID (0) is passed down to PaymentMethodList as invoiceTransferBankAccountID.
Falsy Guard Fallback in PaymentMethodList.tsx:
In src/pages/settings/Wallet/PaymentMethodList.tsx (lines 695–699):
Because invoiceTransferBankAccountID is 0 (falsy), the ternary expression bypasses the workspace invoice check and falls back to checking item.methodID === userWallet?.walletLinkedAccountID (the personal wallet default). Since a business bank account added for workspace invoicing never matches the personal wallet's linked account ID, neither account gets the "Default" badge.
Secondary Rollback Defect in makeDefaultPaymentMethod:
In WorkspaceInvoiceVBASection.tsx (lines 135–140):
formatPaymentMethods sets method.isDefault based on personal wallet defaults (userWallet?.walletLinkedAccountID), NOT workspace invoicing defaults. Thus, previousPaymentMethod reverts to the personal wallet's bank account or 0 on error instead of the actual previous invoicing default.
What changes do you think we should make in order to solve the problem?
Derive Effective Invoice Default in WorkspaceInvoiceVBASection.tsx:
In src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx:
Derive the fallback default from the first eligible business bank account if no explicit default has been persisted yet:
This prevents accidental fallback to personal wallet default when invoiceTransferBankAccountID is provided.
What alternative solutions did you explore? (Optional)
Writing to Onyx / API on mount: Firing a network mutation (setInvoicingTransferBankAccount) on component render when transferBankAccountID is missing is an anti-pattern that triggers unnecessary API roundtrips and side-effects. Deriving effectiveTransferBankAccountID from the eligible business accounts array guarantees synchronous UI accuracy and clean optimistic updates when the user switches defaults.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A. Not critical: the badge and the extra menu option don't block any flow, and the invoice default doesn't move money.
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
The existing test from #76723 caught this bug. We should update it to the steps below, which add the check that "Make default" moves the badge.
Regression Test Proposal
Precondition:
A workspace with Invoices enabled and one verified business bank account added in Invoices > Bank accounts.
Test:
Go to Workspace > Invoices > Bank accounts.
Open the three-dot menu on the bank account and verify "Make default payment method" isn't shown.
Click "Add bank account" and complete the Plaid flow for a second business bank account.
Verify the first bank account shows the "Default" badge.
Open the first bank account's three-dot menu and verify "Make default payment method" isn't shown.
Open the second bank account's three-dot menu and verify "Make default payment method" is shown.
Click "Make default payment method" and verify the "Default" badge moves to the second bank account.
Activity
applause-bot commentedon Sep 21, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/e21af11337954fba98009b3e091facd12764dd07af713724eeab33ab3388c5bb
MelvinBot commentedon Sep 21, 2026
Updated 2026-10-13: Corrected based on feedback from
TaduJRandyuwenmemon.Proposal
Please re-state the problem that we are trying to solve in this issue.
After a workspace has two business bank accounts in Invoices > Bank account, no row shows the "Default" badge, and every row, including the primary one, offers "Make default payment method".
What is the root cause of that problem?
App treats an account as the invoice default only when
policy.invoice.bankAccount.transferBankAccountIDmatches it (WorkspaceInvoiceVBASection.tsx:66). That saved ID often matches no eligible account, for two reasons:OpenPolicyInvoicesPagereturns notransferBankAccountIDbefore or after adding an account, so App falls back to0.TaduJRdeleted the saved default on staging, andOpenPolicyInvoicesPagestill returned the deleted ID.Either way, no row matches the ID. No row gets the badge (
PaymentMethodList.tsx:694), andshouldShowMakeDefaultButtonis true on every row once two accounts exist.What changes do you think we should make in order to solve the problem?
Fix it in App only. App saves nothing until the user presses "Make default".
WorkspaceInvoiceVBASection, derive the invoice default:transferBankAccountIDwhile it matches an eligible account.pendingActionisn'tDELETE). This keeps the badge off a struck-through row that was deleted while offline.isSelectedPaymentMethodDefault), which hides "Make default" on that row.invoiceTransferBankAccountIDprop ofPaymentMethodList(line 286), which shows the badge.deletePaymentMethodand theactivePaymentMethodIDprop unchanged.deletePaymentMethodshould keep comparing against the saved ID. If it used the derived ID, deleting an unsaved derived default would save the next account with the deleted account as the rollback value. A failed request would then make the deleted account the saved default.activePaymentMethodIDhas no effect in this section, because the section doesn't passactionPaymentMethodType(PaymentMethodList.tsx:158-159).makeDefaultPaymentMethod, pass the savedtransferBankAccountIDas the rollback value instead of the Wallet's default account. Today a failed request puts the badge on the Wallet default, which has nothing to do with invoices. Keep thecurrentPaymentMethodlookup and theformatPaymentMethodsimport:paymentMethod.methodIDisstring | number, andsetInvoicingTransferBankAccountneeds anumber.tests/ui/WorkspaceInvoiceVBASectionTest.tsx:jsonCode666): one request is sent, and the badge goes back to the saved default, not the Wallet default.Open question: If invoice payouts go to the workspace's reimbursement account (
policy.achAccount), step 1 should prefer that account, when it's eligible, over the first eligible account. An internal engineer needs to confirm this.What alternative solutions did you explore? (Optional)
yuwenmemonconfirmed nothing on the server uses this value to move money. A backend save and backfill would store a value that only App reads.deletePaymentMethodtoo. Rejected: a failed request can make the deleted account the saved default (see step 3).0check inPaymentMethodList.tsx:694. Rejected: no account matches0or a deleted ID, so the badge still doesn't show.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/101694#issuecomment-5757222080)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
melvin-bot commentedon Sep 21, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @TaduJR (
External)melvin-bot commentedon Sep 21, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
melvin-bot commentedon Sep 24, 2026
@TaduJR Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
ashusatyarthi-wq commentedon Sep 27, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Workspace Settings > Invoices > Bank Account:
After adding a second verified business bank account, the primary (first) bank account does not display the "Default" visual badge, and opening the three-dot menu on the primary bank account unexpectedly shows the "Make default payment method" option.
What is the root cause of that problem?
There are two core root causes working together:
Unassigned Initial Invoicing Default in
WorkspaceInvoiceVBASection.tsx:In
src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx(lines 64–72):When a workspace connects business bank accounts,
policy.invoice.bankAccount.transferBankAccountIDis initially unset (undefined/0). The backend and frontend expect the first eligible business bank account added to the workspace to act as the primary invoice default.Because
transferBankAccountIDremains0:transferBankAccountID === methodID(line 110) evaluates tofalsefor every bank account. Consequently,paymentMethod.isSelectedPaymentMethodDefaultis alwaysfalse.hasMultipleEligibleBankAccountsbecomestrue),shouldShowMakeDefaultButton(line 72) evaluates totruefor both bank accounts.transferBankAccountID(0) is passed down toPaymentMethodListasinvoiceTransferBankAccountID.Falsy Guard Fallback in
PaymentMethodList.tsx:In
src/pages/settings/Wallet/PaymentMethodList.tsx(lines 695–699):Because
invoiceTransferBankAccountIDis0(falsy), the ternary expression bypasses the workspace invoice check and falls back to checkingitem.methodID === userWallet?.walletLinkedAccountID(the personal wallet default). Since a business bank account added for workspace invoicing never matches the personal wallet's linked account ID, neither account gets the "Default" badge.Secondary Rollback Defect in
makeDefaultPaymentMethod:In
WorkspaceInvoiceVBASection.tsx(lines 135–140):formatPaymentMethodssetsmethod.isDefaultbased on personal wallet defaults (userWallet?.walletLinkedAccountID), NOT workspace invoicing defaults. Thus,previousPaymentMethodreverts to the personal wallet's bank account or0on error instead of the actual previous invoicing default.What changes do you think we should make in order to solve the problem?
Derive Effective Invoice Default in
WorkspaceInvoiceVBASection.tsx:In
src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx:effectiveTransferBankAccountIDto evaluate default status and pass toPaymentMethodList:const hasInvoiceDefaultBankAccount = effectiveTransferBankAccountID !== CONST.DEFAULT_NUMBER_ID;const isInvoiceDefaultBankAccountMissing = hasInvoiceDefaultBankAccount && !eligibleBusinessBankAccounts.some((account) => account.accountData?.bankAccountID === effectiveTransferBankAccountID);isSelectedPaymentMethodDefault: effectiveTransferBankAccountID === methodID,makeDefaultPaymentMethod(lines 133–142), useeffectiveTransferBankAccountIDas the previous default parameter forsetInvoicingTransferBankAccount:deletePaymentMethod(line 126), update the default check to useeffectiveTransferBankAccountID === bankAccountID.Fix Explicit Falsy Check in
PaymentMethodList.tsx:In
src/pages/settings/Wallet/PaymentMethodList.tsx(line 697):Check
invoiceTransferBankAccountID !== undefined:This prevents accidental fallback to personal wallet default when
invoiceTransferBankAccountIDis provided.What alternative solutions did you explore? (Optional)
setInvoicingTransferBankAccount) on component render whentransferBankAccountIDis missing is an anti-pattern that triggers unnecessary API roundtrips and side-effects. DerivingeffectiveTransferBankAccountIDfrom the eligible business accounts array guarantees synchronous UI accuracy and clean optimistic updates when the user switches defaults.fix: derive effective default bank account for workspace invoices (Ex…
fix: prevent falsy 0 fallback in shouldShowDefaultBadge (Expensify#10…
ashusatyarthi-wq commentedon Sep 27, 2026
Live Compare Branch & Patch
For convenient verification, I have published a working patch branch against latest
main:🔗 Compare: main...ashusatyarthi-wq:App:fix/invoice-default-ba-badge-101694
effectiveTransferBankAccountIDfrom the first eligible business bank account when no explicit default has been persisted yet.0fallback inPaymentMethodList.tsx(invoiceTransferBankAccountID !== undefined).48 remaining items
melvin-bot commentedon Nov 5, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
mallenexpensify commentedon Nov 5, 2026
Payment Summary
Contributor: @yusufdeveloper2903 paid $175 via Upwork
Contributor+: @TaduJR paid $175 via Upwork.
Both, can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022118168844059773432
$175 cuz
Help Wantedwasn't added, which is currently a requirement@TaduJR plz complete the Contributor+ checklist and tag me in a post once you have. Thx
melvin-bot commentedon Nov 5, 2026
@mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
yusufdeveloper2903 commentedon Nov 5, 2026
@mallenexpensify Thanks! I've accepted the job offer on Upwork
mallenexpensify commentedon Nov 6, 2026
@yusufdeveloper2903 paid, summary updated above. Thx.
@TaduJR can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022118168844059773432
jeffrey-graham commentedon Nov 7, 2026
melvin-bot commentedon Nov 7, 2026
TaduJR commentedon Nov 9, 2026
Contributor+ checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: fix: allow adding a second bank account for invoices #91167 (comment)
Link to the comment on the Issue:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A. Not critical: the badge and the extra menu option don't block any flow, and the invoice default doesn't move money.
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
The existing test from #76723 caught this bug. We should update it to the steps below, which add the check that "Make default" moves the badge.
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
TaduJR commentedon Nov 9, 2026
Offer Accepted @mallenexpensify
Thanks!
mallenexpensify commentedon Nov 9, 2026
@TaduJR paid, summary updated above. Thx.