Skip to content

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

@spradlin-dev

Description

@spradlin-dev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions