From 3d97061d784765b26a10ae2cae9407be32257d57 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 16 Sep 2016 19:59:06 +0100 Subject: [PATCH] Check if we need to fetch more rooms after filter --- src/components/structures/RoomDirectory.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 9f3ee04b..716d2584 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -67,6 +67,7 @@ module.exports = React.createClass({ this.nextBatch = null; this.filterString = null; this.filterTimeout = null; + this.scrollPanel = null; // dis.dispatch({ // action: 'ui_opacity', @@ -194,6 +195,14 @@ module.exports = React.createClass({ onNetworkChange: function(network) { this.setState({ filterByNetwork: network, + }, () => { + // we just filtered out a bunch of rooms, so check to see if + // we need to fill up the scrollpanel again + // NB. Because we filter the results, the HS can keep giving + // us more rooms and we'll keep requesting more if none match + // the filter, which is pretty terrible. We need a way + // to filter by network on the server. + if (this.scrollPanel) this.scrollPanel.checkFillState(); }); }, @@ -338,6 +347,10 @@ module.exports = React.createClass({ return rows; }, + collectScrollPanel: function(element) { + this.scrollPanel = element; + }, + /** * Terrible temporary function that guess what network a public room * entry is in, until synapse is able to tell us @@ -361,7 +374,7 @@ module.exports = React.createClass({ ; } else { const ScrollPanel = sdk.getComponent("structures.ScrollPanel"); - content =