Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix tooltip infinitely recursing (#9235)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Sep 2, 2022
1 parent d1237b2 commit 3e8da6f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/views/elements/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import ReactDOM from 'react-dom';
import classNames from 'classnames';

import UIStore from "../../../stores/UIStore";
import { objectHasDiff } from "../../../utils/objects";

export enum Alignment {
Natural, // Pick left or right
Expand Down Expand Up @@ -91,8 +92,10 @@ export default class Tooltip extends React.PureComponent<ITooltipProps, State> {
this.updatePosition();
}

public componentDidUpdate() {
this.updatePosition();
public componentDidUpdate(prevProps) {
if (objectHasDiff(prevProps, this.props)) {
this.updatePosition();
}
}

// Remove the wrapper element, as the tooltip has finished using it
Expand Down

0 comments on commit 3e8da6f

Please sign in to comment.