From 0479901daa288bd87a645d8827b6530db92b2190 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 12 Apr 2019 10:38:39 -0600 Subject: [PATCH] Load data for permalink creators once --- src/components/structures/RoomView.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 1bcbec4845..acece9271c 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -277,7 +277,13 @@ module.exports = React.createClass({ if (this._permalinkCreators[room.roomId]) return this._permalinkCreators[room.roomId]; this._permalinkCreators[room.roomId] = new RoomPermalinkCreator(room); - this._permalinkCreators[room.roomId].load(); + if (this.state.room && room.roomId === this.state.room.roomId) { + // We want to watch for changes in the creator for the primary room in the view, but + // don't need to do so for search results. + this._permalinkCreators[room.roomId].start(); + } else { + this._permalinkCreators[room.roomId].load(); + } return this._permalinkCreators[room.roomId]; }, @@ -664,9 +670,6 @@ module.exports = React.createClass({ this._loadMembersIfJoined(room); this._calculateRecommendedVersion(room); this._updateE2EStatus(room); - - let creator = this._getPermalinkCreatorForRoom(room); - if (!creator.isStarted()) creator.start(); }, _calculateRecommendedVersion: async function(room) {