Skip to content

Event listener leak #12947

@hally9k

Description

@hally9k

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Accumulating listeners after interacting with input elements and then un-mounting them. If the elements are not interacted with the listener is garbage collected correctly.

Here is a screenshot of the accumulation in a production build:

screen shot 2018-05-31 at 5 13 35 pm

If the current behaviour is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

Use either of the following repros and follow the reproduction instructions in the comments/readme.

For convenience it is reproduced here:
https://codesandbox.io/s/317j2lz8l6

But it is better illustrated by pulling this repro as there is less going on:
https://github.com/hally9k/listener-leak-test

What is the expected behavior?
No accumulation of event listeners.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
macOS@10.13.4
Chrome@66.0.3359.181
react@16.4
react-dom@16.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions