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
I've encountered a bug with the usePlaidLink hook where the open method returned is a noop. Digging into the source code, I believe the issue is here: https://github.com/plaid/react-plaid-link/blob/master/src/usePlaidLink.ts#L51 (window.Plaid is undefined). It seems to happen more often when there are multiple components using the usePlaidLink hook (multiple microdeposits that user need to enter deposits for).
I think this is the case because Error loading Plaid: null appears in the console so there is no error but it still goes down that branch.
My hacky solution right now that works:
I use a custom hook to re-render the component on some interval if window.Plaid is undefined. I then make the useEffect hook inside of usePlaidLink retrigger by passing in a different value for products parameter. Here's a snippet:
function PlaidButton({ plaidToken }) {
const onSuccess = async () => {};
const onExit = async () => {}; // took out actual logic in onSuccess and onExit
useRetryUntilResolved(() => typeof window.Plaid !== 'undefined'); // custom hook to retry
const { open } = usePlaidLink({
token: plaidToken,
onSuccess,
onExit,
product: window.Plaid ? ['auth', 'transactions'] : ['auth'],
});
return <Button title='Verify Microdeposit Amounts' onClick={open as EventFunctionT} />;
}
The text was updated successfully, but these errors were encountered:
I've encountered a bug with the usePlaidLink hook where the open method returned is a noop. Digging into the source code, I believe the issue is here: https://github.com/plaid/react-plaid-link/blob/master/src/usePlaidLink.ts#L51 (window.Plaid is undefined). It seems to happen more often when there are multiple components using the usePlaidLink hook (multiple microdeposits that user need to enter deposits for).
I think this is the case because
Error loading Plaid: null
appears in the console so there is no error but it still goes down that branch.My hacky solution right now that works:
I use a custom hook to re-render the component on some interval if window.Plaid is undefined. I then make the useEffect hook inside of usePlaidLink retrigger by passing in a different value for products parameter. Here's a snippet:
The text was updated successfully, but these errors were encountered: