From 8233dec72e2ed69df381a38421e639633886aa96 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 6 Jul 2020 21:05:06 +0100 Subject: [PATCH] Fix some room list sticky header instabilities Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/LeftPanel2.tsx | 1 + src/components/views/rooms/RoomList2.tsx | 6 +++++- src/components/views/rooms/RoomSublist2.tsx | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/structures/LeftPanel2.tsx b/src/components/structures/LeftPanel2.tsx index 23a9e74646..aed0434b7b 100644 --- a/src/components/structures/LeftPanel2.tsx +++ b/src/components/structures/LeftPanel2.tsx @@ -266,6 +266,7 @@ export default class LeftPanel2 extends React.Component { onFocus={this.onFocus} onBlur={this.onBlur} isMinimized={this.props.isMinimized} + onResize={this.onResize} />; // TODO: Conference handling / calls: https://github.com/vector-im/riot-web/issues/14177 diff --git a/src/components/views/rooms/RoomList2.tsx b/src/components/views/rooms/RoomList2.tsx index b0bb70c9a0..0c754b2c8d 100644 --- a/src/components/views/rooms/RoomList2.tsx +++ b/src/components/views/rooms/RoomList2.tsx @@ -55,6 +55,7 @@ interface IProps { collapsed: boolean; searchFilter: string; isMinimized: boolean; + onResize(); } interface IState { @@ -183,7 +184,9 @@ export default class RoomList2 extends React.Component { layoutMap.set(tagId, new ListLayout(tagId)); } - this.setState({sublists: newLists, layouts: layoutMap}); + this.setState({sublists: newLists, layouts: layoutMap}, () => { + this.props.onResize(); + }); }; private renderCommunityInvites(): React.ReactElement[] { @@ -256,6 +259,7 @@ export default class RoomList2 extends React.Component { isInvite={aesthetics.isInvite} layout={this.state.layouts.get(orderedTagId)} isMinimized={this.props.isMinimized} + onResize={this.props.onResize} extraBadTilesThatShouldntExist={extraTiles} /> ); diff --git a/src/components/views/rooms/RoomSublist2.tsx b/src/components/views/rooms/RoomSublist2.tsx index 21e7c581f0..a1abfb8c7c 100644 --- a/src/components/views/rooms/RoomSublist2.tsx +++ b/src/components/views/rooms/RoomSublist2.tsx @@ -66,6 +66,7 @@ interface IProps { layout: ListLayout; isMinimized: boolean; tagId: TagID; + onResize(); // TODO: Don't use this. It's for community invites, and community invites shouldn't be here. // You should feel bad if you use this. @@ -228,6 +229,7 @@ export default class RoomSublist2 extends React.Component { private toggleCollapsed = () => { this.props.layout.isCollapsed = !this.props.layout.isCollapsed; this.forceUpdate(); // because the layout doesn't trigger an update + setImmediate(() => this.props.onResize()); // needs to happen when the DOM is updated }; private onHeaderKeyDown = (ev: React.KeyboardEvent) => {