Skip to content

Commit 38714de

Browse files
committed
msglist [nfc]: Add a notifyListeners, redundant but to simplify reasoning
Seeing that the tests were expecting a notifyListeners call already, we found that one is already done, in MessageStore.handleUpdateMessageEvent, so this is redundant. But because the new call is done synchronously with the existing call, it doesn't trigger any extra rebuilds, and it helps the reader by making it clear locally that listeners do indeed get notified.
1 parent f420613 commit 38714de

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/model/message_list.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,7 @@ class MessageListView with ChangeNotifier, _MessageSequence {
11031103
case PropagateMode.changeLater:
11041104
_narrow = newNarrow;
11051105
_reset();
1106+
notifyListeners();
11061107
fetchInitial();
11071108
case PropagateMode.changeOne:
11081109
}

test/model/message_list_test.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,13 @@ void main() {
16221622
newStreamId: otherStream.streamId,
16231623
propagateMode: propagateMode,
16241624
));
1625-
checkNotifiedOnce();
1625+
switch (propagateMode) {
1626+
case PropagateMode.changeOne:
1627+
checkNotifiedOnce();
1628+
case PropagateMode.changeLater:
1629+
case PropagateMode.changeAll:
1630+
checkNotified(count: 2);
1631+
}
16261632
async.elapse(const Duration(seconds: 1));
16271633
});
16281634

0 commit comments

Comments
 (0)