@@ -67,6 +67,7 @@ module.exports = React.createClass({
6767 this . nextBatch = null ;
6868 this . filterString = null ;
6969 this . filterTimeout = null ;
70+ this . scrollPanel = null ;
7071
7172 // dis.dispatch({
7273 // action: 'ui_opacity',
@@ -194,6 +195,14 @@ module.exports = React.createClass({
194195 onNetworkChange : function ( network ) {
195196 this . setState ( {
196197 filterByNetwork : network ,
198+ } , ( ) => {
199+ // we just filtered out a bunch of rooms, so check to see if
200+ // we need to fill up the scrollpanel again
201+ // NB. Because we filter the results, the HS can keep giving
202+ // us more rooms and we'll keep requesting more if none match
203+ // the filter, which is pretty terrible. We need a way
204+ // to filter by network on the server.
205+ if ( this . scrollPanel ) this . scrollPanel . checkFillState ( ) ;
197206 } ) ;
198207 } ,
199208
@@ -338,6 +347,10 @@ module.exports = React.createClass({
338347 return rows ;
339348 } ,
340349
350+ collectScrollPanel : function ( element ) {
351+ this . scrollPanel = element ;
352+ } ,
353+
341354 /**
342355 * Terrible temporary function that guess what network a public room
343356 * entry is in, until synapse is able to tell us
@@ -361,7 +374,7 @@ module.exports = React.createClass({
361374 </ div > ;
362375 } else {
363376 const ScrollPanel = sdk . getComponent ( "structures.ScrollPanel" ) ;
364- content = < ScrollPanel
377+ content = < ScrollPanel ref = { this . collectScrollPanel }
365378 className = "mx_RoomDirectory_tableWrapper"
366379 onFillRequest = { this . onFillRequest }
367380 stickyBottom = { false }
0 commit comments