From dd195431a58fc10af37fdf67b773731c30de0640 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Mon, 15 Feb 2021 11:50:33 +0100 Subject: [PATCH] chore: improve channel switch perf Having the Timeline component loaded eagerly made switching between channels rather slow because it always tries to read the current message list from the chats model. This commit changes the layout so that the timeline layout container is only loaded conditionally when indeed activated. --- ui/app/AppMain.qml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index d5ed37a18d..b401f34b80 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -296,6 +296,8 @@ RowLayout { browserLayoutContainer.active = true; } + timelineLayoutContainer.active = this.children[currentIndex] == timelineLayoutContainer + if(this.children[currentIndex] === chatLayoutContainer){ chatLayoutContainer.chatColumn.chatMessages.chatLogView.scrollToBottom(true); } @@ -339,8 +341,11 @@ RowLayout { property var _web3Provider: web3Provider } - TimelineLayout { + Loader { id: timelineLayoutContainer + sourceComponent: TimelineLayout {} + onLoaded: timelineLayoutContainer.item.onActivated() + active: false Layout.fillWidth: true Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.fillHeight: true