-
Couldn't load subscription status.
- Fork 49.7k
Open
Labels
Description
I 've noticed that having an input element focused and unmounting its owner component doesn't actually free up this component from the js heap , I 've created this simple blnkr to demonstarate this which add a dummy X to a ref inside a component that has an input element
React version: 17.0.2
Steps To Reproduce
- Go to this plnkr
- Click Tab Two
- Click the
Grow buttona few times - Take a heap snapshot
- Click the Grow button a few more times
- IMPORTANT Focus the input element by clicking into it
- Click Tab One ( This unmount the component that own the ref to the list )
- Take another heap snapshot ( after running the GC)
- Compare between the two snapshots
- The added string
Xwill be found within the `concat check the screenshot
Link to code example: can be found above
The current behavior
The current component that own the input element is still being there in the memory and doesn't free up its own resources afer being unmounted.
The expected behavior
The current component shloud free up its resources whenever being unmounted
