Skip to content

Commit c0bd682

Browse files
committed
msglist: Send positive numAfter for fetchInitial
This is effectively NFC given normal server behavior. In particular, the Zulip server is smart enough to skip doing any actual work to fetch later messages when the anchor is already `newest`. When we start passing anchors other than `newest`, we'll need this.
1 parent 5b6c13a commit c0bd682

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/model/message_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ class MessageListView with ChangeNotifier, _MessageSequence {
561561
narrow: narrow.apiEncode(),
562562
anchor: AnchorCode.newest,
563563
numBefore: kMessageListFetchBatchSize,
564-
numAfter: 0,
564+
numAfter: kMessageListFetchBatchSize,
565565
allowEmptyTopicName: true,
566566
);
567567
if (this.generation > generation) return;

test/model/message_list_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void main() {
157157
narrow: narrow.apiEncode(),
158158
anchor: 'newest',
159159
numBefore: kMessageListFetchBatchSize,
160-
numAfter: 0,
160+
numAfter: kMessageListFetchBatchSize,
161161
allowEmptyTopicName: true,
162162
);
163163
}

test/widgets/message_list_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ void main() {
373373
'narrow': jsonEncode(narrow.apiEncode()),
374374
'anchor': AnchorCode.newest.toJson(),
375375
'num_before': kMessageListFetchBatchSize.toString(),
376-
'num_after': '0',
376+
'num_after': kMessageListFetchBatchSize.toString(),
377377
'allow_empty_topic_name': 'true',
378378
});
379379
});
@@ -406,7 +406,7 @@ void main() {
406406
'narrow': jsonEncode(narrow.apiEncode()),
407407
'anchor': AnchorCode.newest.toJson(),
408408
'num_before': kMessageListFetchBatchSize.toString(),
409-
'num_after': '0',
409+
'num_after': kMessageListFetchBatchSize.toString(),
410410
'allow_empty_topic_name': 'true',
411411
});
412412
});

0 commit comments

Comments
 (0)