diff --git a/src/components/AddPlaidBankAccount.tsx b/src/components/AddPlaidBankAccount.tsx index e64c95325fae..4111d9cc8e6f 100644 --- a/src/components/AddPlaidBankAccount.tsx +++ b/src/components/AddPlaidBankAccount.tsx @@ -187,6 +187,10 @@ function AddPlaidBankAccount({ onInputChange(plaidAccountID); }; + const handlePlaidError = useCallback((error: ErrorEvent | null) => { + Log.hmmm('[PlaidLink] Error: ', error?.message); + }, []); + if (isPlaidDisabled) { return ( @@ -204,9 +208,7 @@ function AddPlaidBankAccount({ Log.info('[PlaidLink] Success!'); BankAccounts.openPlaidBankAccountSelector(publicToken, metadata?.institution?.name ?? '', allowDebit, bankAccountID); }} - onError={(error) => { - Log.hmmm('[PlaidLink] Error: ', error?.message); - }} + onError={handlePlaidError} onEvent={(event, metadata) => { BankAccounts.setPlaidEvent(event); // Handle Plaid login errors (will potentially reset plaid token and item depending on the error)