[BUG] Children are not cleaned from memory
Bug description When tooltip is rendered with react children, it's not cleaning up rendered children and they remain in the memory
Version of Package v5.28.0
To Reproduce https://react-tooltip.com/docs/examples/children
Hover over example and see DOM nodes in dev tools rising
Expected behavior Children is correctly cleaned up
Screenshots
https://github.com/user-attachments/assets/0e9684f0-f1b0-4823-a451-f64c64ac5371
Desktop
- OS: mac
- Browser: chrome
- Version: 133.0.6943.142
Hi @kamil-sienkiewicz-asi, I'm sorry for the delay!
thanks for reporting and for the recording video, I'll be taking a look as soon as possible
I took a look in the master branch and also in the e v6 branch, I've added a few extra cleanup code to prevent memory leak, but on my tests, looks like there's no relevant progress so far, so I'll add the help wanted label on this one, please feel free to help too if you have any available time.
This issue is stale because it has not seen activity in 30 days. Remove the stale label or comment within 14 days, or it will be closed.
For the time being, is downgrading react-tooltip an option here? 🤔
Guys, can you please test the following version and let us know?
Beta version released with the last commit 🚀
yarn add [email protected]or
npm install [email protected]
Unfortunately, we have a very limited time to dedicate to the project now (I have a recently born child that is consuming almost all of my time), so we would appreciate it if you could check the PR created by Copilot to see if it solves the issue (I reviewed the code, and it looks good to me).
We're still seeing huge amounts of nodes being rendered:
It might however still be an improvement to merge the changes you made (or rather Copilot 😜) in a patch release, as performance has increased at least slightly for us 🤔
When inspecting the heap snapshot, the detainer is actually React Developer Tools 😳 with the extension disabled, I cannot reproduce the detached elements.
https://github.com/user-attachments/assets/a1ab674d-5104-4a99-963e-b6509b038780
So it shouldn't effect normal users. But I cannot reproduce that phenomenon with other Tooltip libraries, so it must be some implementation detail.
It might however still be an improvement to merge the changes you made (or rather Copilot 😜) in a patch release, as performance has increased at least slightly for us 🤔
I'm glad to hear that, @gabrieljablonski can you please review the PR related to that issue too and do a release, please?
When inspecting the heap snapshot, the detainer is actually React Developer Tools 😳 with the extension disabled, I cannot reproduce the detached elements.
Bildschirmaufnahme.2025-10-31.um.12.10.22.mp4 So it shouldn't effect normal users. But I cannot reproduce that phenomenon with other Tooltip libraries, so it must be some implementation detail.
@timohausmann interesting, thanks for sharing the record!
If Gabriel approves the PR and does the release, we will close that issue as solved and if needed, please feel free to open a new issue and link this one.