From 3e8da6ffa4646d21bd26c12600fb603c21a86037 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 2 Sep 2022 10:03:53 +0100 Subject: [PATCH] Fix tooltip infinitely recursing (#9235) --- src/components/views/elements/Tooltip.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/Tooltip.tsx b/src/components/views/elements/Tooltip.tsx index a2298486e8..2741a69936 100644 --- a/src/components/views/elements/Tooltip.tsx +++ b/src/components/views/elements/Tooltip.tsx @@ -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 @@ -91,8 +92,10 @@ export default class Tooltip extends React.PureComponent { 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