Merge pull request #2045 from famedly/karthi/fix-prev-batch
fix: room prev_batch set incorrectly
This commit is contained in:
commit
84c12ff143
|
|
@ -1322,7 +1322,7 @@ class Room {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (onHistoryReceived != null) onHistoryReceived();
|
if (onHistoryReceived != null) onHistoryReceived();
|
||||||
this.prev_batch = resp.end;
|
final newPrevBatch = direction == Direction.b ? resp.end : resp.start;
|
||||||
|
|
||||||
Future<void> loadFn() async {
|
Future<void> loadFn() async {
|
||||||
if (!((resp.chunk.isNotEmpty) && resp.end != null)) return;
|
if (!((resp.chunk.isNotEmpty) && resp.end != null)) return;
|
||||||
|
|
@ -1340,8 +1340,7 @@ class Room {
|
||||||
events: direction == Direction.b
|
events: direction == Direction.b
|
||||||
? resp.chunk
|
? resp.chunk
|
||||||
: resp.chunk.reversed.toList(),
|
: resp.chunk.reversed.toList(),
|
||||||
prevBatch:
|
prevBatch: newPrevBatch,
|
||||||
direction == Direction.b ? resp.end : resp.start,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
@ -1355,8 +1354,7 @@ class Room {
|
||||||
events: direction == Direction.b
|
events: direction == Direction.b
|
||||||
? resp.chunk
|
? resp.chunk
|
||||||
: resp.chunk.reversed.toList(),
|
: resp.chunk.reversed.toList(),
|
||||||
prevBatch:
|
prevBatch: newPrevBatch,
|
||||||
direction == Direction.b ? resp.end : resp.start,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
@ -1370,7 +1368,7 @@ class Room {
|
||||||
if (client.database != null) {
|
if (client.database != null) {
|
||||||
await client.database?.transaction(() async {
|
await client.database?.transaction(() async {
|
||||||
if (storeInDatabase) {
|
if (storeInDatabase) {
|
||||||
await client.database?.setRoomPrevBatch(resp.end, id, client);
|
await client.database?.setRoomPrevBatch(newPrevBatch, id, client);
|
||||||
}
|
}
|
||||||
await loadFn();
|
await loadFn();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue