From 6a840a56d6c232dfc51d6eed79eba6834e7e6edc Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 28 Mar 2019 09:50:17 -0600 Subject: [PATCH] Add a comment to explain the state of affairs for refs.messagePanel --- src/components/structures/RoomView.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 23d5b2f127..3e3e48cf25 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -429,6 +429,12 @@ module.exports = React.createClass({ roomView.addEventListener('dragend', this.onDragLeaveOrEnd); } } + + // Note: We check the ref here with a flag because componentDidMount, despite + // documentation, does not define our messagePanel ref. It looks like our spinner + // in render() prevents the ref from being set on first mount, so we try and + // catch the messagePanel when it does mount. Because we only want the ref once, + // we use a boolean flag to avoid duplicate work. if (this.refs.messagePanel && !this.state.atEndOfLiveTimelineInit) { this.setState({ atEndOfLiveTimelineInit: true,