@@ -137,6 +137,17 @@ abstract class MessageListPageState extends State<MessageListPage> {
137137 /// The narrow for this page's message list.
138138 Narrow get narrow;
139139
140+ /// Resets the [MessageListView] model, triggering an initial fetch.
141+ ///
142+ /// If [anchor] isn't passed, reuses the anchor from the last initial fetch.
143+ ///
144+ /// Useful when updates won't arrive through the event system,
145+ /// as when showing an unsubscribed channel.
146+ /// (New-message events aren't sent for unsubscribed channels.)
147+ ///
148+ /// Does nothing if [MessageList] has not mounted yet.
149+ void refresh ([Anchor ? anchor]);
150+
140151 /// The [ComposeBoxState] for this [MessageListPage] 's compose box,
141152 /// if this [MessageListPage] offers a compose box and it has mounted,
142153 /// else null.
@@ -267,6 +278,14 @@ class _MessageListPageState extends State<MessageListPage> implements MessageLis
267278 @override
268279 late Narrow narrow;
269280
281+ @override
282+ void refresh ([Anchor ? anchor]) {
283+ // TODO If anchor isn't passed, check if there's some onscreen message
284+ // we can anchor to, before defaulting to model.anchor.
285+ // Update the dartdoc on this method with the new behavior.
286+ model? .renarrowAndFetch (narrow, anchor ?? model! .anchor);
287+ }
288+
270289 @override
271290 ComposeBoxState ? get composeBoxState => _composeBoxKey.currentState;
272291 final GlobalKey <ComposeBoxState > _composeBoxKey = GlobalKey ();
0 commit comments