-
-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] On React without concurrent rendering, render
prop produces ResizeObserver errors on Firefox
#1136
Comments
After some looking around, I found this comment suggesting using I don't think we should merge this just yet, in case this introduces some other issues. We'll do some testing later on. The beta version should be fine to use though. |
I think that might fix the error, but I'm concerned whether that is because it fixes the root cause, or if it only makes the browser unable to recognize and stop a resize loop. I believe that the "loop completed with undelivered notifications" error is caused by the I'm also slightly concerned about these 10ms react-tooltip/src/components/Tooltip/Tooltip.tsx Lines 180 to 189 in ee18133
|
I genuinely appreciate your effort in figuring this out, but I'm 95% sure this isn't a real cause for concern. I have some tests in mind to demonstrate that, but I'll only be able to get to my computer later on today. In summary, if you have problematic code causing an issue with
If I recall correctly, this has been tested and there were no issues with it as far as we could tell. I'll try to demonstrate later as well. Again, I really appreciate your effort on this, and I welcome you to keep making suggestions on things we could improve. So thanks! |
First regarding your concern about the 10ms timeout. Since that's the only place the open state gets changed (at least when it's being fully handled internally), all open/close actions are queued on the event loop due to using Here's what happens if we change that 10ms to a full second. tooltip.mp4Now about the Relevant sections (emphasis mine):
According to its own specs, the observer pushes any further changes to the next render cycle, which I'd argue is similar to what we're doing by wrapping the callback with a Feel free to object to any of these conclusions, since I haven't demonstrated they're actually true, just that it's most likely the case. Though unless there's any actual impact to the performance or usability of the tooltip, I'd just leave this as-is if I were you. Even if this is "fixable", it seems like way more trouble than what it's worth. Again, thanks for the effort. |
Official release If you still feel like there's something to improve here, mainly about this part from my previous comment:
feel free to reopen the issue with more details. |
Bug description
When using React <18, or on React 18 and not using concurrent rendering (using
ReactDOM.render()
instead ofcreateRoot().render()
, use of therender
prop produces errors on Firefox. This error is easily and consistently reproduced by rendering a list of elements which all use the samedata-tooltip-id
anddata-tooltip-content
. The error produced is:without a stack trace, which is caught by
window.onerror
handlers (and thus ends up in Sentry and other monitoring platforms).Firefox also issues the following warning in the console:
The app doesn't crash, but the error happens on almost every tooltip hover change (move cursor from element A to element B quickly), and thus produces thousands of errors per session per user on a tooltip-heavy site.
The error can of course be ignored with a regex as it does not crash the app or the tooltips, but clearly there is something wrong.
Version of Package
I have tested the following versions:
To Reproduce
Run the example
When the app is running, quickly swipe your cursor up and down the middle of the page
Notice the error in the webpack dev server's error overlay which pops up
This bug also appears with normal usage (non-furious mouse swiping), but I found this to be the most effective way to reproduce it.
Expected behavior
I prefer this error not to occur, as it forces us to ignore the ResizeObserver error which hides other, unrelated ResizeObserver errors from us.
Desktop (please complete the following information if possible or delete this section):
Additional context
I have managed to reproduce this with Chrome in a larger application, but I have not been able to reproduce the error in the MVP above with Chrome.
The text was updated successfully, but these errors were encountered: