Bug: Potential Memory Leak - Detached elements after DOM Update due to state change
cheng500 opened this issue · 3 comments
cheng500 commented
React version: 18.3.1
Steps To Reproduce
- Create a boolean toggle
- Show 2 different elements based on toggle
- The element that is hidden still exists but is detached
- Repeat to create multiple detached elements
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
mfu2002 commented
For some reason, I cannot recreate this bug on my laptop. Can you try to see if you are able to recreate this issue on a different browser or device?
EDIT: Sorry, I was incorrect. I did manage to create this bug on my laptop. (I was using the debugger incorrectly).
mfu2002 commented