mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-30 16:29:30 +01:00
Merge branch 'soru/store-startup-performance' into 'master'
improve initial loading performance by reducing amoung of sql queries See merge request ChristianPauly/fluffychat-flutter!43
This commit is contained in:
commit
d18801080d
@ -465,13 +465,15 @@ class ExtendedStore extends Store implements ExtendedStoreAPI {
|
|||||||
(onlyLeft ? "=" : "!=") +
|
(onlyLeft ? "=" : "!=") +
|
||||||
"'leave' " +
|
"'leave' " +
|
||||||
" GROUP BY room_id ");
|
" GROUP BY room_id ");
|
||||||
|
List<Map<String, dynamic>> resStates = await _db.rawQuery("SELECT * FROM RoomStates WHERE type IS NOT NULL");
|
||||||
|
List<Map<String, dynamic>> resAccountData = await _db.rawQuery("SELECT * FROM RoomAccountData");
|
||||||
List<Room> roomList = [];
|
List<Room> roomList = [];
|
||||||
for (num i = 0; i < res.length; i++) {
|
for (num i = 0; i < res.length; i++) {
|
||||||
Room room = await Room.getRoomFromTableRow(
|
Room room = await Room.getRoomFromTableRow(
|
||||||
res[i],
|
res[i],
|
||||||
client,
|
client,
|
||||||
states: getStatesFromRoomId(res[i]["room_id"]),
|
states: Future.value(resStates.where((r) => r["room_id"] == res[i]["room_id"]).toList()),
|
||||||
roomAccountData: getAccountDataFromRoomId(res[i]["room_id"]),
|
roomAccountData: Future.value(resAccountData.where((r) => r["room_id"] == res[i]["room_id"]).toList()),
|
||||||
);
|
);
|
||||||
roomList.add(room);
|
roomList.add(room);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user