Skip to content

fix: [@radix-ui/react-tooltip] tooltip performance issue #2720

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

Closed
wants to merge 2 commits into from

Conversation

tangye1234
Copy link

Description

The main purpose of this pr is to resolve the performance issue of tooltip provider.

When there are lots of tooltips inside tooltip provider, everytime tooltip open state is changing, all of the tooltips will re-render regardless of its relation to the iteraction.

I found that provider only provides some context settings and also help to maintain some lifecycle states, while tooltip itself is enough to control its own open state. So I think it is unneccessary for the provider's states to be broadcasted to all context consumers.

@divmgl
Copy link

divmgl commented Sep 16, 2024

Can we get this in? @benoitgrelard @andy-hook

@tangye1234 is there a way I can prevent this from happening at the caller? Seems to be internal inaccessible state, but figured I'd ask.

@ZackMitkin
Copy link

@divmgl, you can try grouping components that have many tooltips in their own <TooltipProvider>.

Would be nice for this optimization to be merged. I have over 500 tooltips on a page which cause a noticeable freeze whenever one of them is hovered. For now, I just wrap components that use many tooltips in their own provider which does fix it

@chaance
Copy link
Member

chaance commented Feb 11, 2025

Dealt with the conflicts and merged locally. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants