Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/Tooltip/TooltipRenderedOnPageBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ class TooltipRenderedOnPageBody extends React.PureComponent {
if (prevProps.text === this.props.text) {
return;
}
this.updateTooltipTextWidth();

// Reset the tooltip text width to 0 so that we can measure it again.
// eslint-disable-next-line react/no-did-update-set-state
this.setState({tooltipTextWidth: 0}, this.updateTooltipTextWidth);
Comment on lines +80 to +83

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This lint is correct - the placement of this is not ideal as we're adding infinite re-renders here
Can you find a better placement to reset the tooltip text width?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

    if (prevProps.text === this.props.text) {
          return;
      }

this line will prevent the infinite re-rendering , we are only updating tooltipTextWidth , once , when text changes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah good point, missed that

}

updateTooltipTextWidth() {
Expand Down
2 changes: 0 additions & 2 deletions src/styles/getTooltipStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ export default function getTooltipStyles(
color: themeColors.textReversed,
fontFamily: fontFamily.GTA,
fontSize: tooltipFontSize,
overflowWrap: 'normal',
overflow: 'hidden',
whiteSpace: 'nowrap',
},
pointerWrapperStyle: {
position: 'fixed',
Expand Down