Skip to content

Commit ede818a

Browse files
committed
msglist: Implement refresh, to be used for unsubscribed channels
1 parent 70eedc1 commit ede818a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/widgets/message_list.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ 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+
/// at [anchor].
142+
///
143+
/// Useful when updates won't arrive through the event system,
144+
/// as when showing an unsubscribed channel.
145+
/// (New-message events aren't sent for unsubscribed channels.)
146+
///
147+
/// Does nothing if [MessageList] has not mounted yet.
148+
void refresh(Anchor anchor);
149+
140150
/// The [ComposeBoxState] for this [MessageListPage]'s compose box,
141151
/// if this [MessageListPage] offers a compose box and it has mounted,
142152
/// else null.
@@ -267,6 +277,9 @@ class _MessageListPageState extends State<MessageListPage> implements MessageLis
267277
@override
268278
late Narrow narrow;
269279

280+
@override
281+
void refresh(Anchor anchor) => model?.renarrowAndFetch(narrow, anchor);
282+
270283
@override
271284
ComposeBoxState? get composeBoxState => _composeBoxKey.currentState;
272285
final GlobalKey<ComposeBoxState> _composeBoxKey = GlobalKey();

0 commit comments

Comments
 (0)