-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[bug]: Tooltip has redundant TooltipProvider based on documentation. #7166
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
Comments
But how do you then adjust the delayDuration? |
I am pretty sure wherever you implement the |
So if I want to have different durations than defined in my Tooltip ShadCn component, I need to wrap every Tooltip again with a TooltipProvider as described in the documentation? If I want to have the default duration, I just can remove the unnecessary TooltipProvider wrapper as you discovered? |
The ability to have custom durations is preserved just via a different implementation. If you want to do a weird app where you have 30 different durations, then you are still able to do so. The default shouldn't be automatically creating 30 TooltipProviders for some obscure use case. Also, the parent TooltipProvider is redundant and not even necessary in the current implementation. That alone is a code smell. |
Regarding redundant TooltipProvider in every Tooltip that's an obvious mistake. We can create separate providers where it's justified. I can imagine different scopes of the application where there is a zero delay duration for some interactive editor and a default delay for common menu buttons etc. What's more important I think that overriding default RadixUI My current implementation is just:
Since
|
Describe the bug
https://github.com/shadcn-ui/ui/blob/main/apps/v4/registry/new-york-v4/ui/tooltip.tsx
The documentation for Tooltips is as follows:
However, the implementation of
Tooltip
has a redundantTooltipProvider
implemented if you follow the documentation.This caused a significant performance hit in my application which was fixed by removing the duplicate
TooltipProvider
implementation on everyTooltip
instance.Affected component/components
Tooltip
How to reproduce
Implement 60
Tooltip
components in a canvas application.Codesandbox/StackBlitz link
No response
Logs
System Info
Before submitting
The text was updated successfully, but these errors were encountered: