fix: Don't sort rooms too often

This commit is contained in:
Sorunome 2020-09-27 10:54:54 +02:00
parent b6754fbc46
commit 877ff9963c
No known key found for this signature in database
GPG key ID: B19471D07FC9BE9C

View file

@ -787,6 +787,7 @@ class Client extends MatrixApi {
await _handleRooms(sync.rooms.leave, Membership.leave, await _handleRooms(sync.rooms.leave, Membership.leave,
sortAtTheEnd: sortAtTheEnd); sortAtTheEnd: sortAtTheEnd);
} }
_sortRooms();
} }
if (sync.presence != null) { if (sync.presence != null) {
for (final newPresence in sync.presence) { for (final newPresence in sync.presence) {
@ -1112,7 +1113,6 @@ class Client extends MatrixApi {
} }
if (rooms[j].onUpdate != null) rooms[j].onUpdate.add(rooms[j].id); if (rooms[j].onUpdate != null) rooms[j].onUpdate.add(rooms[j].id);
} }
_sortRooms();
} }
void _updateRoomsByEventUpdate(EventUpdate eventUpdate) { void _updateRoomsByEventUpdate(EventUpdate eventUpdate) {
@ -1160,7 +1160,6 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
break; break;
} }
room.onUpdate.add(room.id); room.onUpdate.add(room.id);
if (['timeline', 'account_data'].contains(eventUpdate.type)) _sortRooms();
} }
bool _sortLock = false; bool _sortLock = false;