Skip to content

Commit 04e9c10

Browse files
xsahil03xclaude
andcommitted
refactor(core): move thread-conversation guard into _reloadChannelIfNeeded
Encapsulates the early-return conditions in one place so callers don't need to know which contexts skip the reload. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b7cbab4 commit 04e9c10

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/stream_chat_flutter_core/lib/src/message_list_core.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ class MessageListCoreState extends State<MessageListCore> {
293293
// If the channel is up to date, we don't need to reload it.
294294
if (_upToDate) return;
295295

296+
// Thread conversations share the parent channel; reloading from a
297+
// disposing thread would clobber the channel page state.
298+
if (_isThreadConversation) return;
299+
296300
try {
297301
return await _streamChannel?.reloadChannel();
298302
} catch (_) {
@@ -305,7 +309,7 @@ class MessageListCoreState extends State<MessageListCore> {
305309
@override
306310
void dispose() {
307311
_teardownController(widget.messageListController);
308-
if (!_isThreadConversation) _reloadChannelIfNeeded();
312+
_reloadChannelIfNeeded();
309313
super.dispose();
310314
}
311315
}

0 commit comments

Comments
 (0)