You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-13 08:02:38 +03:00
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:
@@ -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();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user