@@ -65,9 +65,11 @@ class MessageListMessageItem extends MessageListMessageBaseItem {
6565
6666/// The status of outstanding or recent fetch requests from a [MessageListView] .
6767enum FetchingStatus {
68- /// The model hasn't successfully completed a `fetchInitial` request
69- /// (since its last reset, if any).
70- unfetched,
68+ /// The model has not made any fetch requests (since its last reset, if any).
69+ unstarted,
70+
71+ /// The model has made a `fetchInitial` request, which hasn't succeeded.
72+ fetchInitial,
7173
7274 /// The model made a successful `fetchInitial` request,
7375 /// and has no outstanding requests or backoff.
@@ -111,7 +113,10 @@ mixin _MessageSequence {
111113 ///
112114 /// This allows the UI to distinguish "still working on fetching messages"
113115 /// from "there are in fact no messages here".
114- bool get fetched => _status != FetchingStatus .unfetched;
116+ bool get fetched => switch (_status) {
117+ FetchingStatus .unstarted || FetchingStatus .fetchInitial => false ,
118+ _ => true ,
119+ };
115120
116121 /// Whether we know we have the oldest messages for this narrow.
117122 ///
@@ -143,7 +148,7 @@ mixin _MessageSequence {
143148 /// See also [fetchingOlder] .
144149 bool get fetchOlderCoolingDown => _status == FetchingStatus .fetchOlderCoolingDown;
145150
146- FetchingStatus _status = FetchingStatus .unfetched ;
151+ FetchingStatus _status = FetchingStatus .unstarted ;
147152
148153 BackoffMachine ? _fetchOlderCooldownBackoffMachine;
149154
@@ -319,7 +324,7 @@ mixin _MessageSequence {
319324 messages.clear ();
320325 middleMessage = 0 ;
321326 _haveOldest = false ;
322- _status = FetchingStatus .unfetched ;
327+ _status = FetchingStatus .unstarted ;
323328 _fetchOlderCooldownBackoffMachine = null ;
324329 contents.clear ();
325330 items.clear ();
@@ -504,7 +509,8 @@ class MessageListView with ChangeNotifier, _MessageSequence {
504509 // TODO(#82): fetch from a given message ID as anchor
505510 assert (! fetched && ! haveOldest && ! fetchingOlder && ! fetchOlderCoolingDown);
506511 assert (messages.isEmpty && contents.isEmpty);
507- assert (_status == FetchingStatus .unfetched);
512+ assert (_status == FetchingStatus .unstarted);
513+ _status = FetchingStatus .fetchInitial;
508514 // TODO schedule all this in another isolate
509515 final generation = this .generation;
510516 final result = await getMessages (store.connection,
@@ -528,7 +534,7 @@ class MessageListView with ChangeNotifier, _MessageSequence {
528534 _addMessage (message);
529535 // Now [middleMessage] is the last message (the one just added).
530536 }
531- assert (_status == FetchingStatus .unfetched );
537+ assert (_status == FetchingStatus .fetchInitial );
532538 _status = FetchingStatus .idle;
533539 _haveOldest = result.foundOldest;
534540 notifyListeners ();
0 commit comments