@@ -66,9 +66,11 @@ class MessageListMessageItem extends MessageListMessageBaseItem {
6666
6767/// The status of outstanding or recent fetch requests from a [MessageListView] .
6868enum FetchingStatus {
69- /// The model hasn't successfully completed a `fetchInitial` request
70- /// (since its last reset, if any).
71- unfetched,
69+ /// The model has not made any fetch requests (since its last reset, if any).
70+ unstarted,
71+
72+ /// The model has made a `fetchInitial` request, which hasn't succeeded.
73+ fetchInitial,
7274
7375 /// The model made a successful `fetchInitial` request,
7476 /// and has no outstanding requests or backoff.
@@ -112,7 +114,10 @@ mixin _MessageSequence {
112114 ///
113115 /// This allows the UI to distinguish "still working on fetching messages"
114116 /// from "there are in fact no messages here".
115- bool get fetched => _status != FetchingStatus .unfetched;
117+ bool get fetched => switch (_status) {
118+ FetchingStatus .unstarted || FetchingStatus .fetchInitial => false ,
119+ _ => true ,
120+ };
116121
117122 /// Whether we know we have the oldest messages for this narrow.
118123 ///
@@ -144,7 +149,7 @@ mixin _MessageSequence {
144149 /// See also [fetchingOlder] .
145150 bool get fetchOlderCoolingDown => _status == FetchingStatus .fetchOlderCoolingDown;
146151
147- FetchingStatus _status = FetchingStatus .unfetched ;
152+ FetchingStatus _status = FetchingStatus .unstarted ;
148153
149154 BackoffMachine ? _fetchOlderCooldownBackoffMachine;
150155
@@ -320,7 +325,7 @@ mixin _MessageSequence {
320325 messages.clear ();
321326 middleMessage = 0 ;
322327 _haveOldest = false ;
323- _status = FetchingStatus .unfetched ;
328+ _status = FetchingStatus .unstarted ;
324329 _fetchOlderCooldownBackoffMachine = null ;
325330 contents.clear ();
326331 items.clear ();
@@ -534,7 +539,8 @@ class MessageListView with ChangeNotifier, _MessageSequence {
534539 // TODO(#82): fetch from a given message ID as anchor
535540 assert (! fetched && ! haveOldest && ! fetchingOlder && ! fetchOlderCoolingDown);
536541 assert (messages.isEmpty && contents.isEmpty);
537- assert (_status == FetchingStatus .unfetched);
542+ assert (_status == FetchingStatus .unstarted);
543+ _status = FetchingStatus .fetchInitial;
538544 // TODO schedule all this in another isolate
539545 final generation = this .generation;
540546 final result = await getMessages (store.connection,
@@ -558,7 +564,7 @@ class MessageListView with ChangeNotifier, _MessageSequence {
558564 _addMessage (message);
559565 // Now [middleMessage] is the last message (the one just added).
560566 }
561- assert (_status == FetchingStatus .unfetched );
567+ assert (_status == FetchingStatus .fetchInitial );
562568 _status = FetchingStatus .idle;
563569 _haveOldest = result.foundOldest;
564570 notifyListeners ();
0 commit comments