tippyjs-react
tippyjs-react copied to clipboard
Suggestion - lazy load Tippy instances by default
Hey there maintainers :)
First of all, thank you very much for this library! It has really made the difference for me and my company on how focused and reliable it is, specially compared to other "tooltip/popovers" libraries.
In the product I'm working on, I have recently come up with several use cases where I needed to use tooltips for markers in a google maps instance. It was all good for a few items in the map until I decided to add more just to test stats like performance. The performance dropped considerably and the issue was how all the tooltips of each marker were being mounted even if not showing. I did some research and found this awesome example of yours: https://gist.github.com/atomiks/520f4b0c7b537202a23a3059d4eec908#file-lazytippy-jsx
My question is simple: Is there a specific reason why this behavior is not done by default?
I can sort of imagine a use case where it could have a negative effect on performance if the tooltip content being rendered takes a lot of time mouting to the dom. It also ends up mounting/remouting on each mouseenter/mouseleave (from my understanding) but in the majority of the cases this wouldn't be a problem and the developer could take care of it's own lazy initialization of the component (or whatever is causing a massive mount time) himself.
I would love to hear what you think of this and I can already appreciate the time spent reading it.
Cheers!
I only made that gist recently but I did want to make the behavior default, I'd need to see how it works with singletons first to ensure there are no issues
I see @atomiks, thanks for the quick reply!
I hope it can be done without breaking singletons behavior :)
Cheers
I'll keep it open till we implement it 😄
We also implemented this lazy behavior in our app due to decreased performance with many Tippy instances 👍
@atomiks is someone actively working on that? I could take it on :)
@cscheffauer sorry for the late reply but no one has worked on this. There's an issue with singleton integration because they assume the content already has been rendered/exists. Something needs to be rewritten, hopefully without any breaking changes...