fix(persistence): fix offline message pagination (#1361)
* fix(persistence): fix offline message pagination * chore(persistence): update changelog * fix(persistence): fix pagination offline * fix test
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:stream_chat_persistence/src/db/drift_chat_database.dart';
|
||||
@@ -170,7 +172,9 @@ class MessageDao extends DatabaseAccessor<DriftChatDatabase>
|
||||
}
|
||||
}
|
||||
if (messagePagination?.limit != null) {
|
||||
return msgList.take(messagePagination!.limit).toList();
|
||||
return msgList
|
||||
.skip(max(0, msgList.length - messagePagination!.limit))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
return msgList;
|
||||
|
||||
Reference in New Issue
Block a user