diff --git a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx index 0febd5f4ada0..9e501422764d 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx @@ -57,7 +57,13 @@ function WorkspaceCardsListLabel({type, value, style}: WorkspaceCardsListLabelPr const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`); const paymentBankAccountID = cardSettings?.paymentBankAccountID; - const isConnectedWithPlaid = useMemo(() => !!bankAccountList?.[paymentBankAccountID ?? 0]?.accountData?.additionalData?.plaidAccountID, [bankAccountList, paymentBankAccountID]); + const isConnectedWithPlaid = useMemo(() => { + const bankAccountData = bankAccountList?.[paymentBankAccountID ?? 0]?.accountData; + + // TODO: remove the extra check when plaidAccountID storing is aligned in https://github.com/Expensify/App/issues/47944 + // Right after adding a bank account plaidAccountID is stored inside the accountData and not in the additionalData + return !!bankAccountData?.plaidAccountID || !!bankAccountData?.additionalData?.plaidAccountID; + }, [bankAccountList, paymentBankAccountID]); useEffect(() => { if (!anchorRef.current || !isVisible) { diff --git a/src/types/onyx/AccountData.ts b/src/types/onyx/AccountData.ts index 010715f15f85..6bb69cd78dc4 100644 --- a/src/types/onyx/AccountData.ts +++ b/src/types/onyx/AccountData.ts @@ -36,6 +36,9 @@ type AccountData = { /** The bankAccountID in the bankAccounts db */ bankAccountID?: number; + /** Unique identifier for this account in Plaid */ + plaidAccountID?: string; + /** All data related to the bank account */ additionalData?: BankAccountAdditionalData;