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

iframe element not removed when component is unmounted, resulting in duplicate iframes #299

Open
spradlin-dev opened this issue Nov 6, 2024 · 1 comment

Comments

@spradlin-dev
Copy link

react-google-recaptcha version: 3.1.0
react-async-script version: 1.2.0

Our recaptcha is being mounted inside of a modal, but when the modal is closed (and unmounted) the iframe that was created by react-google-recaptcha does not get cleaned up. This means that if the user opens and closes the modal multiple times, we end up with multiple iframes, as the recaptcha creates a new one each time it is mounted. This is, in essence, a memory leak as these hidden elements just keep adding up and never get cleaned up until a full page refresh.

@Barjaktarevic
Copy link

Barjaktarevic commented Dec 20, 2024

I have the exact same issue; the recaptcha is inside the body of a chat widget. Every time the user opens the widget, a new iframe is created, and the previous one(s) remain in the document.

This seems to happen every time the recaptcha is inside a component that is conditionally rendered.

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

2 participants