Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Potential Memory Leak - Detached elements after DOM Update due to state change #31818

Open
cheng500 opened this issue Dec 17, 2024 · 0 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@cheng500
Copy link

React version: 18.3.1

Steps To Reproduce

  1. Create a boolean toggle
  2. Show 2 different elements based on toggle
  3. The element that is hidden still exists but is detached
  4. Repeat to create multiple detached elements

image

Link to code example:
https://codesandbox.io/p/sandbox/modest-yalow-n2m86y
https://n2m86y.csb.app/

The current behavior

Elements are never removed from memory

The expected behavior

Elements should be removed from memory

@cheng500 cheng500 added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Dec 17, 2024
@cheng500 cheng500 changed the title Bug: Potential Memory Leak - Detached elements after state change leading to DOM Update Bug: Potential Memory Leak - Detached elements after DOM Update due to state change Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

1 participant