From 01adcff77e26620a2e8c779547b0341ce4eb9604 Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 14 Apr 2020 10:55:01 -0400 Subject: [PATCH] Reduce the number of room delegate errors --- src/backend/matrix_client.py | 1 + src/gui/MainPane/AccountRoomsDelegate.qml | 14 ++++++++++++-- src/gui/PythonBridge/Privates/EventHandlers.qml | 8 ++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index 5c25713f..86089415 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -761,6 +761,7 @@ class MatrixClient(nio.AsyncClient): # If a new room was added, wait for onSyncResponse to set the token await asyncio.sleep(0.1) + print( self.lazy_load_filter) response = await self.room_messages( room_id = room_id, start = self.past_tokens[room_id], diff --git a/src/gui/MainPane/AccountRoomsDelegate.qml b/src/gui/MainPane/AccountRoomsDelegate.qml index c9821ce8..edb11f89 100644 --- a/src/gui/MainPane/AccountRoomsDelegate.qml +++ b/src/gui/MainPane/AccountRoomsDelegate.qml @@ -21,6 +21,8 @@ Column { readonly property alias collapsed: account.collapsed readonly property alias roomList: roomList + onFirstSyncDoneChanged: print("fsd") + Account { id: account @@ -55,7 +57,11 @@ Column { } delegate: HLoader { - active: firstSyncDone && (inView || model.index === 0) + asynchronous: false + active: firstSyncDone && inView + + onInViewChanged: print("iv") + width: roomList.width height: roomList.firstDelegateHeight @@ -80,13 +86,17 @@ Column { highlight: null // managed by the AccountRoomsList + onFirstDelegateHeightChanged: firstDelegateHeight = firstDelegateHeight + // Delete 0 must *always* be loaded, and all delegates must have the // same height - readonly property int firstDelegateHeight: + property int firstDelegateHeight: contentItem.visibleChildren[0] ? contentItem.visibleChildren[0].implicitHeight : 0 + property var pr: firstDelegateHeight + onPrChanged: print("pr changed:", pr) readonly property bool hasActiveRoom: window.uiState.page === "Pages/Chat/Chat.qml" && diff --git a/src/gui/PythonBridge/Privates/EventHandlers.qml b/src/gui/PythonBridge/Privates/EventHandlers.qml index 1d74628c..1843a195 100644 --- a/src/gui/PythonBridge/Privates/EventHandlers.qml +++ b/src/gui/PythonBridge/Privates/EventHandlers.qml @@ -51,13 +51,13 @@ QtObject { function onModelItemSet(syncId, indexThen, indexNow, changedFields){ if (indexThen === undefined) { - print("insert", syncId, indexThen, indexNow, - JSON.stringify(changedFields)) + // print("insert", syncId, indexThen, indexNow, + // JSON.stringify(changedFields)) ModelStore.get(syncId).insert(indexNow, changedFields) } else { - print("set", syncId, indexThen, indexNow, - JSON.stringify(changedFields)) + // print("set", syncId, indexThen, indexNow, + // JSON.stringify(changedFields)) const model = ModelStore.get(syncId) model.set(indexThen, changedFields) if (indexThen !== indexNow) model.move(indexThen, indexNow, 1)