Browser freezes with "Page unresponsive" because of react-tooltip #1125
-
Hello guys, we are facing a tough to reproduce issue with our application freezing the whole page (in some sort of an infinite loop) in rare occasions. We are building an enterprise application with thousands of elements on the screen and many tooltips. The problem seems to appear after upgrading to the latest version of react-tooltip when we do filtering on a large table with many cells with tooltips. Pressing F8 to open the devtools when the page becomes unresponsive leads us to React Fiber callstack, which after some digging points us to the root of the infinite loop - the autoUpdate from "@floating-ui/dom" triggers updateTooltipPosition over and over in an infinite loop, presumably on an anchor element that's no longer present in the DOM. I don't have a way of reliably reproducing this let alone isolating it in a sandbox so I can't open an issue, but any ideas on what I can do to debug this next time it happens would be really appreciated. @gabrieljablonski, probably related to this commit - 3b411f0 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hey @revov. As you can see here, it is possible to disable This is not optimal, since you might not wish to have the tooltip close automatically when scrolling, though it's a good starting point to figure out this specific issue. Since you can't reproduce it reliably, it might be a little tricky to know for sure Feel free to add more info here to see if we can help you figure something out, but if at any point you're able to reliably reproduce this, please open an issue with the details. We may also consider adding a new |
Beta Was this translation helpful? Give feedback.
-
@revov I just hit a similar issue too and was able to find the root cause, see if your problem is the same After a little more digging we found that, we never unmount React-Tooltip and it keeps attaching event listeners to DOM nodes and never clears it since its never unmounted and since the event listeners are never removed the RAM usage keeps on increasing eventually making the page unresponsive. |
Beta Was this translation helpful? Give feedback.
-
I just ran into a very similar issue that was triggered by my tests. Essentially I had a component that was showing and showing its tool tip, and then after a short delay it unmounts and hides it. This was fine in an physical case I could make, but my test would lock up about one out of every 3 attempts at this, and seemed to be more likely the more other animations I had going on, so it was some type of race condition. I believe that the timing ended up being that as the tooltip was animating away the component got unmounted. I have no way to make a minimal repro case, so I don't want to make a bug for it, but just thought I would help this conversation Oddly was seeing this on 5.26.3 but after seeing this issue #1182 I decided to try 5.26.0 and now I cannot repro the issue again. |
Beta Was this translation helpful? Give feedback.
Hey @revov.
As you can see here, it is possible to disable
autoUpdate
usage by settingglobalCloseEvents.resize
(orcloseOnResize
, if on a version prior to v5.22.0).This is not optimal, since you might not wish to have the tooltip close automatically when scrolling, though it's a good starting point to figure out this specific issue. Since you can't reproduce it reliably, it might be a little tricky to know for sure
autoUpdate
is the sole reason for the problem.Feel free to add more info here to see if we can help you figure something out, but if at any point you're able to reliably reproduce this, please open an issue with the details.
We may also consider adding a new
disableAutoUpdate
…