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