Fix filtering causing sticky header artifacts
In 7b97c3032b
we reduced the RoomList updates to just added/removed sublists, but didn't consider that we might also have to handle lengths of those sublists changing enough for us to fix the sticky headers.
This commit is contained in:
parent
9969b01c5f
commit
7e50464eeb
1 changed files with 16 additions and 1 deletions
|
@ -239,7 +239,22 @@ export default class RoomList extends React.Component<IProps, IState> {
|
||||||
const previousListIds = Object.keys(this.state.sublists);
|
const previousListIds = Object.keys(this.state.sublists);
|
||||||
const newListIds = Object.keys(newLists);
|
const newListIds = Object.keys(newLists);
|
||||||
|
|
||||||
if (arrayHasDiff(previousListIds, newListIds)) {
|
let doUpdate = arrayHasDiff(previousListIds, newListIds);
|
||||||
|
if (!doUpdate) {
|
||||||
|
// so we didn't have the visible sublists change, but did the contents of those
|
||||||
|
// sublists change significantly enough to break the sticky headers? Probably, so
|
||||||
|
// let's check the length of each.
|
||||||
|
for (const tagId of newListIds) {
|
||||||
|
const oldRooms = this.state.sublists[tagId];
|
||||||
|
const newRooms = newLists[tagId];
|
||||||
|
if (oldRooms.length !== newRooms.length) {
|
||||||
|
doUpdate = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doUpdate) {
|
||||||
this.setState({sublists: newLists}, () => {
|
this.setState({sublists: newLists}, () => {
|
||||||
this.props.onResize();
|
this.props.onResize();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue