From 83283cedd3faba1d4fea8778b4adbac3b0214ef9 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Wed, 11 Sep 2024 15:33:10 +0200 Subject: [PATCH 1/2] Hide request limit button if bank was connected via Plaid --- .../workspace/expensifyCard/WorkspaceCardsListLabel.tsx | 5 ++++- src/types/onyx/AccountData.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx index 0febd5f4ada0..d4a031aa71bb 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx @@ -57,7 +57,10 @@ 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; + 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; From 1a2c7429197885f8160385197f88ac4d47b74331 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Wed, 11 Sep 2024 16:04:08 +0200 Subject: [PATCH 2/2] Add TODO and explanation --- src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx index d4a031aa71bb..9e501422764d 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx @@ -59,6 +59,9 @@ function WorkspaceCardsListLabel({type, value, style}: WorkspaceCardsListLabelPr 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]);