make LazyRenderList stateful for better performance

it only rerenders when visible range it would render based on the
props gets OVERFLOW_MARGIN(5) items from the current renderRange
This commit is contained in:
Bruno Windels 2019-02-13 17:16:20 +01:00
parent 9c371111b7
commit 60d0ed4c01
2 changed files with 81 additions and 22 deletions

View file

@ -61,14 +61,14 @@ const RoomSubList = React.createClass({
getInitialState: function() {
// throttle updates to LazyRenderList
this._onScroll = _.throttle(
this._onScroll, 100,
{leading: false, trailing: true},
);
this._updateLazyRenderHeight = _.throttle(
this._updateLazyRenderHeight, 100,
{leading: false, trailing: true},
);
// this._onScroll = _.throttle(
// this._onScroll, 50,
// {leading: false, trailing: true},
// );
// this._updateLazyRenderHeight = _.throttle(
// this._updateLazyRenderHeight, 100,
// {leading: false, trailing: true},
// );
return {
hidden: this.props.startAsHidden || false,
// some values to get LazyRenderList starting
@ -307,7 +307,7 @@ const RoomSubList = React.createClass({
{this._getHeaderJsx(isCollapsed)}
</div>;
} else {
const items = this.props.list.concat(this.props.extraTiles);
const items = this.props.list; //.concat(this.props.extraTiles);
return <div ref="subList" className={subListClasses}>
{this._getHeaderJsx(isCollapsed)}
<IndicatorScrollbar ref="scroller" className="mx_RoomSubList_scroll" onScroll={ this._onScroll }>