Skip to content
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

fix: Prevent Tooltip setState call if not open #5363

Merged
merged 2 commits into from
Feb 17, 2020

Conversation

grommett
Copy link
Contributor

This PR prevents the handleClickOutside from calling setState if the ToolTip is already closed. This same code change was merged in the previous version of Carbon React.

The reason for this check is that, at scale, these calls create real performance issues.

Our app has over 1,000 <Tooltip />s. Each of these <Tooltip />s calls setState({open: false}) for any click in the UI. The unnecessary calls to setState makes toggling radio buttons and opening Modals very, very slow. Up to two seconds in some cases in our UI. After adding this check the UI behaves normally.

Changelog

Changed

  • Adds a check to the handleClickOutside method.

Testing / Reviewing

Below is a performance screenshot with current behavior.
Screen Shot 2019-12-06 at 11 02 21 AM

@grommett grommett requested a review from a team as a code owner February 15, 2020 06:33
@ghost ghost requested review from aledavila and emyarod February 15, 2020 06:33
@netlify
Copy link

netlify bot commented Feb 15, 2020

Deploy preview for carbon-elements ready!

Built with commit 187df6e

https://deploy-preview-5363--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Feb 15, 2020

Deploy preview for carbon-components-react ready!

Built with commit 187df6e

https://deploy-preview-5363--carbon-components-react.netlify.com

Copy link
Contributor

@xxxle0 xxxle0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@asudoh
Copy link
Contributor

asudoh commented Feb 17, 2020

Hi 👋 @grommett thank for sending this PR - Covered by: #5336

@asudoh asudoh closed this Feb 17, 2020
@emyarod
Copy link
Member

emyarod commented Feb 17, 2020

@asudoh it looks like this is for tooltip rather than overflow menu and should be a port of carbon-design-system/carbon-components-react#2424 right?

@grommett
Copy link
Contributor Author

Agreed @emyarod. @asudoh Can we re-open this?

@emyarod emyarod reopened this Feb 17, 2020
Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@asudoh asudoh merged commit aa276b2 into carbon-design-system:master Feb 17, 2020
@asudoh
Copy link
Contributor

asudoh commented Feb 17, 2020

@grommett My apologies for confusing this one with the other!

@emyarod emyarod mentioned this pull request Feb 25, 2020
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants