Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plaid link iframe is not removed #325

Open
lorentzimys opened this issue Oct 24, 2023 · 1 comment
Open

Plaid link iframe is not removed #325

lorentzimys opened this issue Oct 24, 2023 · 1 comment

Comments

@lorentzimys
Copy link

Hi there!
I've noticed that iframe that is created by usePlaidLink hook is not removed on successful scenario, so when I start plaid linking process multiple times - a new iframe is created each time. The only case when iframe is not recreated is when I close plaid link window and onError callback is triggered.

I've noticed that this behaviour happens because usePlaidLink effect fires an exit method on unmout, but destroy callback is not triggered:
image

React component to reproduce:

import React, { useEffect } from 'react';
import { PlaidLinkOptions, usePlaidLink } from 'react-plaid-link';

interface PlaidLinkProps {
  options: PlaidLinkOptions;
}

export const PlaidLink: React.FC<PlaidLinkProps> = ({ options }) => {
  const { open, ready } = usePlaidLink(options);

  useEffect(() => {
    if (ready) {
      open();
    }
  }, [ready]);

  useEffect(() => {
    return () => {
      console.log('unmount');
    };
  }, []);

  return (<></>);
};
@lorentzimys
Copy link
Author

I think this issue is related to opened PR #226

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant