Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/stream_chat_persistence/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- Add indices on the `channel_cid` column on the `Messages`, `Members`, and `Reads` tables to improve read times on large databases.
- Add indices on the `message_id` column on the `Reactions` table to improve read times on large databases.

🐞 Fixed

- `MessageDao.getThreadMessagesByParentId` now treats a `PaginationParams.limit` of `0` as "unset" and returns all matching replies, instead of returning none.

## 10.1.0

✅ Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class MessageDao extends DatabaseAccessor<DriftChatDatabase> with _$MessageDaoMi
);
}

if (options != null) {
if (options != null && options.limit > 0) {
query.limit(options.limit);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,26 @@ void main() {
expect(replies.last.id, threadId(29));
});

test('limit of 0 is treated as unset and returns all replies', () async {
await _prepareTestData(
cid,
threads: true,
mapAllThreadToFirstMessage: true,
count: 30,
);

final replies = await messageDao.getThreadMessagesByParentId(
parentId,
options: const PaginationParams(limit: 0),
);

// limit: 0 is treated as "unset" → no SQL LIMIT is applied → all 30
// replies are returned in ASC order: id0..id29.
expect(replies.length, 30);
expect(replies.first.id, threadId(0));
expect(replies.last.id, threadId(29));
});

test('lessThan only excludes the cursor', () async {
await _prepareTestData(
cid,
Expand Down
Loading