This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 227
Memory leak when Reference children are removed from a page #312
Comments
It looks like the reason this is happening is because of this line in The |
Thanks for the report! Would you mind if I asked you to send a PR with a proposed fix? |
Already working on it :) I should have one up later this morning |
@FezVrasta Got a PR up for this. LMK if you want anything changed on it. |
FezVrasta
pushed a commit
that referenced
this issue
Nov 6, 2019
* fix: referenceNode memory leak Instead of storing referenceNode in state, store it in a class property. This is done to enable the component to cleanup referenceNode’s value during unmounting. I also added unit tests to account for this change, but that resulted in me having to update some dependencies and snapshots to get unit tests to pass. * CR: Create separate setter and getter contexts In order to help reduce re-renders of the Reference component, this commit creates separate context objects for the setters and getters of the referenceNode attribute. This also removes the need for a context object, so it simplifies the management of the referenceNode attribute in the Manager class. * CR Feedback: remove need for componentWillUnmount * FIx flow * Update size snapshot
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Reproduction demo
https://codesandbox.io/s/react-popper-v1x-issue-template-3hcp9
Steps to reproduce the problem
demo/index.js
file with the code inindex.js
of the codesandbox's index.js filereferenceNode
is retaining the div elementWhat is the expected behavior?
referenceNode
inManager
is set tonull
when the Reference element is removed from the page.What went wrong?
When the Reference element is removed from the page, the
ref
value passed to the Manager context is retained. This creates a memory leak in situations where the reference element is regularly removed from a page.Any other comments?
Packages versions
The text was updated successfully, but these errors were encountered: