Merge branch 'nico/fix-null-events-in-legacy-db' into 'main'
fix: properly handle events not already in the hivedb Closes famedly/app#1798 See merge request famedly/company/frontend/famedlysdk!1127
This commit is contained in:
commit
7a9e5cbb85
|
|
@ -374,17 +374,14 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads a whole list of events at once from the store for a specific room
|
/// Loads a whole list of events at once from the store for a specific room
|
||||||
Future<List<Event>> _getEventsByIds(List<String> eventIds, Room room) =>
|
Future<List<Event>> _getEventsByIds(List<String> eventIds, Room room) async {
|
||||||
Future.wait(eventIds
|
final events = await Future.wait(eventIds.map((String eventId) async {
|
||||||
.map(
|
final entry = await _eventsBox.get(MultiKey(room.id, eventId).toString());
|
||||||
(eventId) async => Event.fromJson(
|
return entry is Map ? Event.fromJson(convertToJson(entry), room) : null;
|
||||||
convertToJson(
|
}));
|
||||||
await _eventsBox.get(MultiKey(room.id, eventId).toString()),
|
|
||||||
),
|
return events.whereType<Event>().toList();
|
||||||
room,
|
}
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList());
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<Event>> getEventList(
|
Future<List<Event>> getEventList(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue