File tree 1 file changed +13
-1
lines changed
src/components/structures 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ module.exports = React.createClass({
66
66
}
67
67
this . nextBatch = null ;
68
68
this . filterString = null ;
69
+ this . filterTimeout = null ;
69
70
70
71
// dis.dispatch({
71
72
// action: 'ui_opacity',
@@ -209,7 +210,18 @@ module.exports = React.createClass({
209
210
this . showRoomAlias ( alias ) ;
210
211
} else {
211
212
this . filterString = alias || null ;
212
- this . refreshRoomList ( ) ;
213
+
214
+ // don't send the request for a little bit,
215
+ // no point hammering the server with a
216
+ // request for every keystroke, let the
217
+ // user finish typing.
218
+ if ( this . filterTimeout ) {
219
+ clearTimeout ( this . filterTimeout ) ;
220
+ }
221
+ this . filterTimeout = setTimeout ( ( ) => {
222
+ this . filterTimeout = null ;
223
+ this . refreshRoomList ( ) ;
224
+ } , 300 ) ;
213
225
}
214
226
} ,
215
227
You can’t perform that action at this time.
0 commit comments