Open
Description
I am creating a simple tooltip where tooltip content is rendered in a portal when hovered upon. This creates detached nodes. Added a github test repo and videos of the same.
React version:
"react": "^19.0.0",
"react-dom": "^19.0.0"
Steps To Reproduce
- Clone the repo. repo link
- Use
TooltipWithoutKey
inApp.tsx
file. - Hover multiple times.
- Take heap snapshot.
- Detached nodes are noticed.
- Now use
TooltipWithKey
inApp.tsx
file. - No detached nodes noticed.
Also tried using the 3rd key argument for createPortal
, but it did not work. Which is why the Fragment
with key prop was used.
Link to code example: https://github.com/kart-c/react-dom-issue
TooltipWithoutKey
tooltip_without_key.mp4
TooltipWithKey
tooltip_with_key.mp4
The current behavior
Detached nodes are created.
The expected behavior
Detached nodes should not be created.