@@ -282,7 +282,7 @@ const RoomSubList = React.createClass({
282
282
this . setState ( { scrollTop : this . refs . scroller . getScrollTop ( ) } ) ;
283
283
} ,
284
284
285
- _getRenderItems : function ( ) {
285
+ _getList : function ( ) {
286
286
// try our best to not create a new array
287
287
// because LazyRenderList rerender when the items prop
288
288
// is not the same object as the previous value
@@ -296,6 +296,12 @@ const RoomSubList = React.createClass({
296
296
return list . concat ( extraTiles ) ;
297
297
} ,
298
298
299
+ _canUseLazyListRendering ( ) {
300
+ // for now disable lazy rendering as they are already rendered tiles
301
+ // not rooms like props.list we pass to LazyRenderList
302
+ return ! this . props . extraTiles || ! this . props . extraTiles . length ;
303
+ } ,
304
+
299
305
render : function ( ) {
300
306
const len = this . props . list . length + this . props . extraTiles . length ;
301
307
const isCollapsed = this . state . hidden && ! this . props . forceExpand ;
@@ -310,7 +316,7 @@ const RoomSubList = React.createClass({
310
316
return < div ref = "subList" className = { subListClasses } >
311
317
{ this . _getHeaderJsx ( isCollapsed ) }
312
318
</ div > ;
313
- } else {
319
+ } else if ( this . _canUseLazyListRendering ( ) ) {
314
320
return < div ref = "subList" className = { subListClasses } >
315
321
{ this . _getHeaderJsx ( isCollapsed ) }
316
322
< IndicatorScrollbar ref = "scroller" className = "mx_RoomSubList_scroll" onScroll = { this . _onScroll } >
@@ -319,7 +325,16 @@ const RoomSubList = React.createClass({
319
325
height = { this . state . scrollerHeight }
320
326
renderItem = { this . makeRoomTile }
321
327
itemHeight = { 34 }
322
- items = { this . _getRenderItems ( ) } />
328
+ items = { this . props . list } />
329
+ </ IndicatorScrollbar >
330
+ </ div > ;
331
+ } else {
332
+ const roomTiles = this . props . list . map ( r => this . makeRoomTile ( r ) ) ;
333
+ const tiles = roomTiles . concat ( this . props . extraTiles ) ;
334
+ return < div ref = "subList" className = { subListClasses } >
335
+ { this . _getHeaderJsx ( isCollapsed ) }
336
+ < IndicatorScrollbar ref = "scroller" className = "mx_RoomSubList_scroll" onScroll = { this . _onScroll } >
337
+ { tiles }
323
338
</ IndicatorScrollbar >
324
339
</ div > ;
325
340
}
0 commit comments