Reduce the number of room delegate errors

This commit is contained in:
miruka 2020-04-14 10:55:01 -04:00
parent 6536f89507
commit 01adcff77e
3 changed files with 17 additions and 6 deletions

View File

@ -761,6 +761,7 @@ class MatrixClient(nio.AsyncClient):
# If a new room was added, wait for onSyncResponse to set the token # If a new room was added, wait for onSyncResponse to set the token
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
print( self.lazy_load_filter)
response = await self.room_messages( response = await self.room_messages(
room_id = room_id, room_id = room_id,
start = self.past_tokens[room_id], start = self.past_tokens[room_id],

View File

@ -21,6 +21,8 @@ Column {
readonly property alias collapsed: account.collapsed readonly property alias collapsed: account.collapsed
readonly property alias roomList: roomList readonly property alias roomList: roomList
onFirstSyncDoneChanged: print("fsd")
Account { Account {
id: account id: account
@ -55,7 +57,11 @@ Column {
} }
delegate: HLoader { delegate: HLoader {
active: firstSyncDone && (inView || model.index === 0) asynchronous: false
active: firstSyncDone && inView
onInViewChanged: print("iv")
width: roomList.width width: roomList.width
height: roomList.firstDelegateHeight height: roomList.firstDelegateHeight
@ -80,13 +86,17 @@ Column {
highlight: null // managed by the AccountRoomsList highlight: null // managed by the AccountRoomsList
onFirstDelegateHeightChanged: firstDelegateHeight = firstDelegateHeight
// Delete 0 must *always* be loaded, and all delegates must have the // Delete 0 must *always* be loaded, and all delegates must have the
// same height // same height
readonly property int firstDelegateHeight: property int firstDelegateHeight:
contentItem.visibleChildren[0] ? contentItem.visibleChildren[0] ?
contentItem.visibleChildren[0].implicitHeight : contentItem.visibleChildren[0].implicitHeight :
0 0
property var pr: firstDelegateHeight
onPrChanged: print("pr changed:", pr)
readonly property bool hasActiveRoom: readonly property bool hasActiveRoom:
window.uiState.page === "Pages/Chat/Chat.qml" && window.uiState.page === "Pages/Chat/Chat.qml" &&

View File

@ -51,13 +51,13 @@ QtObject {
function onModelItemSet(syncId, indexThen, indexNow, changedFields){ function onModelItemSet(syncId, indexThen, indexNow, changedFields){
if (indexThen === undefined) { if (indexThen === undefined) {
print("insert", syncId, indexThen, indexNow, // print("insert", syncId, indexThen, indexNow,
JSON.stringify(changedFields)) // JSON.stringify(changedFields))
ModelStore.get(syncId).insert(indexNow, changedFields) ModelStore.get(syncId).insert(indexNow, changedFields)
} else { } else {
print("set", syncId, indexThen, indexNow, // print("set", syncId, indexThen, indexNow,
JSON.stringify(changedFields)) // JSON.stringify(changedFields))
const model = ModelStore.get(syncId) const model = ModelStore.get(syncId)
model.set(indexThen, changedFields) model.set(indexThen, changedFields)
if (indexThen !== indexNow) model.move(indexThen, indexNow, 1) if (indexThen !== indexNow) model.move(indexThen, indexNow, 1)