Skip to content

Commit 7b0e405

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 f9efd71 commit 7b0e405

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
@@ -531,7 +531,7 @@ class MessageListView with ChangeNotifier, _MessageSequence {
531531
narrow: narrow.apiEncode(),
532532
anchor: AnchorCode.newest,
533533
numBefore: kMessageListFetchBatchSize,
534-
numAfter: 0,
534+
numAfter: kMessageListFetchBatchSize,
535535
allowEmptyTopicName: true,
536536
);
537537
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
@@ -330,7 +330,7 @@ void main() {
330330
'narrow': jsonEncode(narrow.apiEncode()),
331331
'anchor': AnchorCode.newest.toJson(),
332332
'num_before': kMessageListFetchBatchSize.toString(),
333-
'num_after': '0',
333+
'num_after': kMessageListFetchBatchSize.toString(),
334334
'allow_empty_topic_name': 'true',
335335
});
336336
});
@@ -363,7 +363,7 @@ void main() {
363363
'narrow': jsonEncode(narrow.apiEncode()),
364364
'anchor': AnchorCode.newest.toJson(),
365365
'num_before': kMessageListFetchBatchSize.toString(),
366-
'num_after': '0',
366+
'num_after': kMessageListFetchBatchSize.toString(),
367367
'allow_empty_topic_name': 'true',
368368
});
369369
});

0 commit comments

Comments
 (0)