react-tooltip icon indicating copy to clipboard operation
react-tooltip copied to clipboard

[BUG] Children are not cleaned from memory

Open kamil-sienkiewicz-asi opened this issue 9 months ago • 9 comments

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

kamil-sienkiewicz-asi avatar Feb 28 '25 16:02 kamil-sienkiewicz-asi

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

danielbarion avatar Mar 06 '25 13:03 danielbarion

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.

danielbarion avatar Mar 11 '25 15:03 danielbarion

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.

github-actions[bot] avatar Jun 10 '25 12:06 github-actions[bot]

For the time being, is downgrading react-tooltip an option here? 🤔

CHE1RON avatar Oct 02 '25 06:10 CHE1RON

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).

danielbarion avatar Oct 10 '25 17:10 danielbarion

We're still seeing huge amounts of nodes being rendered:

Image

CHE1RON avatar Oct 24 '25 05:10 CHE1RON

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 🤔

CHE1RON avatar Oct 31 '25 07:10 CHE1RON

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.

timohausmann avatar Oct 31 '25 11:10 timohausmann

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.

danielbarion avatar Oct 31 '25 17:10 danielbarion