Skip to content

Commit 44b49be

Browse files
gnpricechrisbobbe
authored andcommitted
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 14a6695 commit 44b49be

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
@@ -404,7 +404,7 @@ void main() {
404404
'narrow': jsonEncode(narrow.apiEncode()),
405405
'anchor': AnchorCode.newest.toJson(),
406406
'num_before': kMessageListFetchBatchSize.toString(),
407-
'num_after': '0',
407+
'num_after': kMessageListFetchBatchSize.toString(),
408408
'allow_empty_topic_name': 'true',
409409
});
410410
});
@@ -437,7 +437,7 @@ void main() {
437437
'narrow': jsonEncode(narrow.apiEncode()),
438438
'anchor': AnchorCode.newest.toJson(),
439439
'num_before': kMessageListFetchBatchSize.toString(),
440-
'num_after': '0',
440+
'num_after': kMessageListFetchBatchSize.toString(),
441441
'allow_empty_topic_name': 'true',
442442
});
443443
});

0 commit comments

Comments
 (0)