-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
awaiting-author-responseIssues or PRs waiting for more information from the authorIssues or PRs waiting for more information from the authorissue/bug-unconfirmedIssues that describe a bug that hasn't been confirmed by a maintainer yetIssues that describe a bug that hasn't been confirmed by a maintainer yet
Description
When using react-select, after the component is destroyed by e.g. not rendering it or more realistic example by page navigation, it leave a detached nodes that can not be garbage collected because they are not freed properly somewhere.
Link to reproduce: https://codesandbox.io/s/blissful-dream-l22yoq?file=/src/App.js
How to reproduce: https://learn.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/memory-problems/dom-leaks
Steps:
- Open https://l22yoq.csb.app/
- Open devtools -> Detached elements and click Get Detached Elements button. Observe there are no detached elements
- click on the select and choose randomly options
- click the hide button below the select to stop rendering it
- click Get Detached Elements button in the devtools
- click collect garbage button to force GC
- click Analyse button to analyse the current heap snapshot
- see there is item that is still referenced, check the last column where you have @SomeNumber value
Video:
Screen.Recording.2023-05-10.at.9.07.40.mov
Expected behaviour:
When react-select is no longer rendered it should not leave detached elements, as they pile up and cause a memory leak.
haldunanil
Metadata
Metadata
Assignees
Labels
awaiting-author-responseIssues or PRs waiting for more information from the authorIssues or PRs waiting for more information from the authorissue/bug-unconfirmedIssues that describe a bug that hasn't been confirmed by a maintainer yetIssues that describe a bug that hasn't been confirmed by a maintainer yet