Skip to content

Commit 3d7fac1

Browse files
committed
msglist [nfc]: Add public renarrowAndFetch method, and use internally
We'll use this in keyword search, coming up, for renarrowing when the user submits a new keyword.
1 parent f5ba6ec commit 3d7fac1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/model/message_list.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,14 @@ class MessageListView with ChangeNotifier, _MessageSequence {
618618
Narrow get narrow => _narrow;
619619
Narrow _narrow;
620620

621+
/// Set [narrow] to [newNarrow], reset, [notifyListeners], and [fetchInitial].
622+
void renarrowAndFetch(Narrow newNarrow) {
623+
_narrow = newNarrow;
624+
_reset();
625+
notifyListeners();
626+
fetchInitial();
627+
}
628+
621629
/// The anchor point this message list starts from in the message history.
622630
///
623631
/// This is passed to the server in the get-messages request
@@ -1101,10 +1109,7 @@ class MessageListView with ChangeNotifier, _MessageSequence {
11011109
switch (propagateMode) {
11021110
case PropagateMode.changeAll:
11031111
case PropagateMode.changeLater:
1104-
_narrow = newNarrow;
1105-
_reset();
1106-
notifyListeners();
1107-
fetchInitial();
1112+
renarrowAndFetch(newNarrow);
11081113
case PropagateMode.changeOne:
11091114
}
11101115
}

0 commit comments

Comments
 (0)