mirror of https://github.com/vector-im/riot-web
				
				
				
			Merge pull request #2631 from matrix-org/bwindels/roomlistfilterfix
update range when items size changespull/21833/head
						commit
						5aa08a0f02
					
				|  | @ -62,8 +62,13 @@ export default class LazyRenderList extends React.Component { | |||
|     componentWillReceiveProps(props) { | ||||
|         const state = this.state; | ||||
|         const range = LazyRenderList.getVisibleRangeFromProps(props); | ||||
|         // only update state if the new range isn't contained by the old anymore
 | ||||
|         if (!state.renderRange || !state.renderRange.contains(range.expand(OVERFLOW_MARGIN))) { | ||||
|         const intersectRange = range.expand(OVERFLOW_MARGIN); | ||||
| 
 | ||||
|         const prevSize = this.props.items ? this.props.items.length : 0; | ||||
|         const listHasChangedSize = props.items.length !== prevSize; | ||||
|         // only update renderRange if the list has shrunk/grown and we need to adjust padding or
 | ||||
|         // if the new range isn't contained by the old anymore
 | ||||
|         if (listHasChangedSize || !state.renderRange || !state.renderRange.contains(intersectRange)) { | ||||
|             this.setState({renderRange: range.expand(OVERFLOW_ITEMS)}); | ||||
|         } | ||||
|     } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Bruno Windels
						Bruno Windels