From eb4220a836972ca470b3bffd5916921631410e55 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 6 Nov 2019 10:31:05 +0100 Subject: [PATCH 1/3] scroll panels should be in flex container so they don't grow w/ content --- res/css/structures/_FilePanel.scss | 1 + res/css/structures/_NotificationPanel.scss | 1 + 2 files changed, 2 insertions(+) diff --git a/res/css/structures/_FilePanel.scss b/res/css/structures/_FilePanel.scss index 703e90f402..87e885e668 100644 --- a/res/css/structures/_FilePanel.scss +++ b/res/css/structures/_FilePanel.scss @@ -18,6 +18,7 @@ limitations under the License. order: 2; flex: 1 1 0; overflow-y: auto; + display: flex; } .mx_FilePanel .mx_RoomView_messageListWrapper { diff --git a/res/css/structures/_NotificationPanel.scss b/res/css/structures/_NotificationPanel.scss index 78b3522d4e..c9e0261ec9 100644 --- a/res/css/structures/_NotificationPanel.scss +++ b/res/css/structures/_NotificationPanel.scss @@ -18,6 +18,7 @@ limitations under the License. order: 2; flex: 1 1 0; overflow-y: auto; + display: flex; } .mx_NotificationPanel .mx_RoomView_messageListWrapper { From 9fa7990996ec89f2301f6cc4f3d4ab3860a7b7cd Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 6 Nov 2019 10:31:56 +0100 Subject: [PATCH 2/3] prevent error for empty list --- src/components/structures/ScrollPanel.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index 32efad1e05..1d5c520285 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -759,8 +759,10 @@ module.exports = createReactClass({ _getMessagesHeight() { const itemlist = this.refs.itemlist; const lastNode = itemlist.lastElementChild; + const lastNodeBottom = lastNode ? lastNode.offsetTop + lastNode.clientHeight : 0; + const firstNodeTop = itemlist.firstElementChild ? itemlist.firstElementChild.offsetTop : 0; // 18 is itemlist padding - return (lastNode.offsetTop + lastNode.clientHeight) - itemlist.firstElementChild.offsetTop + (18 * 2); + return lastNodeBottom - firstNodeTop + (18 * 2); }, _topFromBottom(node) { From 842bf77409184a028e721cb50abb5a50c7b655fb Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 6 Nov 2019 10:32:20 +0100 Subject: [PATCH 3/3] prevent error when nextProps is null, cleanup As the FilePanel is now rendered as part of the RoomView, we don't need to respond to room changes, as RoomView has a key of the roomId, so the whole subtree would be recreated. --- src/components/structures/FilePanel.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/components/structures/FilePanel.js b/src/components/structures/FilePanel.js index c7e8295f80..f5a5912dd5 100644 --- a/src/components/structures/FilePanel.js +++ b/src/components/structures/FilePanel.js @@ -39,23 +39,10 @@ const FilePanel = createReactClass({ }; }, - componentWillMount: function() { + componentDidMount: function() { this.updateTimelineSet(this.props.roomId); }, - componentWillReceiveProps: function(nextProps) { - if (nextProps.roomId !== this.props.roomId) { - // otherwise we race between re-rendering the TimelinePanel and setting the new timelineSet. - // - // FIXME: this race only happens because of the promise returned by getOrCreateFilter(). - // We should only need to create the containsUrl filter once per login session, so in practice - // it shouldn't be being done here at all. Then we could just update the timelineSet directly - // without resetting it first, and speed up room-change. - this.setState({ timelineSet: null }); - this.updateTimelineSet(nextProps.roomId); - } - }, - updateTimelineSet: function(roomId) { const client = MatrixClientPeg.get(); const room = client.getRoom(roomId);