Suggestion - lazy load Tippy instances by default
#209 opened on May 7, 2020
Repository metrics
- Stars
- (1,803 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
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!