-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Break word on InfoTooltip #3532
Conversation
This is great, we are seeing this issue a lot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read recently that {{}}
in React are typically to be avoided as it forces PureComponent
to re-render every time the parent re-renders since the object is regenerated and there's a new objectid.
The solution is to simply declare the const in module scope as in:
const tooltipStyle = { wordWrap: 'break-word' }
[out of scope for this PR] I've been thinking we should grep for |
Coverage remained the same at 69.927% when pulling 462a489c06abe4f6a69b3d6f48324b3fc1b8a313 on michellethomas:tooltip_wrap_word into 7d934e7 on apache:master. |
2 similar comments
Coverage remained the same at 69.927% when pulling 462a489c06abe4f6a69b3d6f48324b3fc1b8a313 on michellethomas:tooltip_wrap_word into 7d934e7 on apache:master. |
Coverage remained the same at 69.927% when pulling 462a489c06abe4f6a69b3d6f48324b3fc1b8a313 on michellethomas:tooltip_wrap_word into 7d934e7 on apache:master. |
462a489
to
bd100ff
Compare
1 similar comment
Interesting, thanks for the information. I had heard that defining a function when passing it through as a prop could have performance implications, but didn't know it applied to objects as well. |
* Break word on InfoTooltip * Moving style object to separate const
* Break word on InfoTooltip * Moving style object to separate const
Someone on slack mentioned that the text was getting cut off for the expression tooltip. Because it's one long string with no word breaks, the expression text gets cut off. I'm proposing adding
wordWrap: 'break-word'
to the InfoTooltipWithTrigger so that the text will wrap.If you don't think this should be the default behavior for all tooltips, I can change it to pass the styles in.
It looks like there's no bootstrap class for
break-word
. If there's a better way to add specific styles in, let me know.Before:
After: