Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed May 8, 2023
1 parent 8cdba0e commit ec87028
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Tooltip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ class Tooltip extends PureComponent {
<>
{this.state.isRendered && (
<TooltipRenderedOnPageBody
key={[this.props.text, ...this.props.renderTooltipContentKey]}
animation={this.animation}
windowWidth={this.props.windowWidth}
xOffset={this.state.xOffset}
Expand All @@ -197,6 +196,10 @@ class Tooltip extends PureComponent {
maxWidth={this.props.maxWidth}
numberOfLines={this.props.numberOfLines}
renderTooltipContent={this.props.renderTooltipContent}

// We pass a key, so whenever the content changes this component will completely remount with a fresh state.
// This prevents flickering/moving while remaining performant.
key={[this.props.text, ...this.props.renderTooltipContentKey]}
/>
)}
<Hoverable
Expand Down

0 comments on commit ec87028

Please sign in to comment.