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 1/3] 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) => { From 60225154e6c2e2e18c026f1353567150d7b59182 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 6 Jul 2020 21:58:44 +0100 Subject: [PATCH 2/3] delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomSublist2.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomSublist2.tsx b/src/components/views/rooms/RoomSublist2.tsx index a1abfb8c7c..88f0f662c4 100644 --- a/src/components/views/rooms/RoomSublist2.tsx +++ b/src/components/views/rooms/RoomSublist2.tsx @@ -66,12 +66,13 @@ 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. extraBadTilesThatShouldntExist?: React.ReactElement[]; + onResize(); + // TODO: Account for https://github.com/vector-im/riot-web/issues/14179 } From abfbcf409008c53e642370f1fdb323a388816df2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 6 Jul 2020 22:04:30 +0100 Subject: [PATCH 3/3] use uglier style for props but be consistent :'( Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomList2.tsx | 2 +- src/components/views/rooms/RoomSublist2.tsx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/RoomList2.tsx b/src/components/views/rooms/RoomList2.tsx index 0c754b2c8d..421e6abd12 100644 --- a/src/components/views/rooms/RoomList2.tsx +++ b/src/components/views/rooms/RoomList2.tsx @@ -51,11 +51,11 @@ interface IProps { onKeyDown: (ev: React.KeyboardEvent) => void; onFocus: (ev: React.FocusEvent) => void; onBlur: (ev: React.FocusEvent) => void; + onResize: () => void; resizeNotifier: ResizeNotifier; collapsed: boolean; searchFilter: string; isMinimized: boolean; - onResize(); } interface IState { diff --git a/src/components/views/rooms/RoomSublist2.tsx b/src/components/views/rooms/RoomSublist2.tsx index 88f0f662c4..2ca9ec5dd1 100644 --- a/src/components/views/rooms/RoomSublist2.tsx +++ b/src/components/views/rooms/RoomSublist2.tsx @@ -66,13 +66,12 @@ interface IProps { layout: ListLayout; isMinimized: boolean; tagId: TagID; + onResize: () => void; // 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. extraBadTilesThatShouldntExist?: React.ReactElement[]; - onResize(); - // TODO: Account for https://github.com/vector-im/riot-web/issues/14179 }