Skip to content

Commit

Permalink
Merge pull request Expensify#48984 from VickyStash/bugfix/hide-reques…
Browse files Browse the repository at this point in the history
…t-limit-button

[Workspace Feeds] Hide request limit button if the settlement account was connected via Plaid
  • Loading branch information
MariaHCD authored Sep 12, 2024
2 parents 336e478 + 1a2c742 commit 2830add
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/AccountData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 2830add

Please sign in to comment.