Skip to content

Commit cd06c42

Browse files
committed
Fixed pagination
1 parent 1087cdd commit cd06c42

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/src/class/supabase_chat_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class SupabaseChatController {
7373
.select()
7474
.eq('roomId', int.parse(_room.id))
7575
.order('createdAt', ascending: false)
76-
.range(pageSize * _currentPage, (_currentPage * pageSize) + pageSize);
76+
.range(pageSize * _currentPage, (_currentPage * pageSize) + pageSize - 1);
7777

7878
void _onData(
7979
List<Map<String, dynamic>> newData,

lib/src/class/supabase_chat_core.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ class SupabaseChatCore {
356356
: table.select();
357357
var query = queryUnlimited.order('updatedAt', ascending: false);
358358
if (offset != null && limit != null) {
359-
query = query.range(offset, offset + limit);
359+
query = query.range(offset, offset + limit - 1);
360360
} else if (limit != null) {
361361
query = query.limit(limit);
362362
}
@@ -574,7 +574,7 @@ class SupabaseChatCore {
574574
.order('firstName', ascending: true)
575575
.order('lastName', ascending: true);
576576
if (offset != null && limit != null) {
577-
query = query.range(offset, offset + limit);
577+
query = query.range(offset, offset + limit - 1);
578578
} else if (limit != null) {
579579
query = query.limit(limit);
580580
}

0 commit comments

Comments
 (0)