From 8f75bce29ee3be7ce8a6792e40fa8c6229d610e4 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 7 Sep 2016 16:09:44 +0100 Subject: [PATCH] add fixmes --- src/components/structures/FilePanel.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/structures/FilePanel.js b/src/components/structures/FilePanel.js index b8752da619..95fd978f59 100644 --- a/src/components/structures/FilePanel.js +++ b/src/components/structures/FilePanel.js @@ -44,7 +44,12 @@ var FilePanel = React.createClass({ componentWillReceiveProps: function(nextProps) { if (nextProps.roomId !== this.props.roomId) { - // otherwise we race between updating the TimelinePanel and determining the new timelineSet + // otherwise we race between re-rendering the TimelinePanel and setting the new timelineSet. + // + // FIXME: this race only happens because of the promise returned by getOrCreateFilter(). + // We should only need to create the containsUrl filter once per login session, so in practice + // it shouldn't be being done here at all. Then we could just update the timelineSet directly + // without resetting it first, and speed up room-change. this.setState({ timelineSet: null }); this.updateTimelineSet(nextProps.roomId); } @@ -66,6 +71,7 @@ var FilePanel = React.createClass({ } ); + // FIXME: we shouldn't be doing this every time we change room - see comment above. client.getOrCreateFilter("FILTER_FILES_" + client.credentials.userId, filter).then( (filterId)=>{ filter.filterId = filterId;