From e3a3dec8a21782007651b1a44b5c45143d1704ff Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Mon, 26 Mar 2018 11:53:39 +0100 Subject: [PATCH] Move variables out of state. --- src/components/views/rooms/RoomTooltip.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/views/rooms/RoomTooltip.js b/src/components/views/rooms/RoomTooltip.js index 398c96b4de..5e766a665f 100644 --- a/src/components/views/rooms/RoomTooltip.js +++ b/src/components/views/rooms/RoomTooltip.js @@ -43,11 +43,7 @@ module.exports = React.createClass({ document.body.appendChild(this.tooltipContainer); window.addEventListener('scroll', this._renderTooltip, true); - const parent = ReactDOM.findDOMNode(this).parentNode; - this.state={ - parent, - parentBox: parent.getBoundingClientRect(), - }; + this.parent = ReactDOM.findDOMNode(this).parentNode; this._renderTooltip(); }, @@ -70,7 +66,7 @@ module.exports = React.createClass({ }, _updatePosition(style) { - const parentBox = this.state.parent.getBoundingClientRect(); + const parentBox = this.parent.getBoundingClientRect(); let offset = 0; if (parentBox.height > MIN_TOOLTIP_HEIGHT) { offset = Math.floor((parentBox.height - MIN_TOOLTIP_HEIGHT) / 2); @@ -117,8 +113,8 @@ module.exports = React.createClass({ render: function() { // Render a placeholder return ( -
+
); - } + }, });