From 1275f752f3ad9be26a63663e32cafc7288025765 Mon Sep 17 00:00:00 2001 From: Krille Date: Sun, 4 May 2025 13:24:28 +0200 Subject: [PATCH] fix: Do not load timeline while sync is processed This sometimes lead to the problem that the timeline misses the newest messages. Especially when opening the app from a notification this can happen. --- lib/src/room.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/src/room.dart b/lib/src/room.dart index affb06f3..8bfeff94 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -1525,14 +1525,16 @@ class Room { }) async { await postLoad(); - List events; + var events = []; if (!isArchived) { - events = await client.database?.getEventList( - this, - limit: limit, - ) ?? - []; + await client.database?.transaction(() async { + events = await client.database?.getEventList( + this, + limit: limit, + ) ?? + []; + }); } else { final archive = client.getArchiveRoomFromCache(id); events = archive?.timeline.events.toList() ?? [];