Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/stream_chat_flutter_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Upcoming

🐞 Fixed

- Fixed an issue with `StreamChannel` where loading channel at `lastReadMessageId` might fail
if the channel exceeds the member threshold. This is now handled gracefully by falling back to loading
the channel at the `lastRead` date.

🔄 Changed

- Updated `freezed_annotation` dependency to `">=2.4.1 <4.0.0"`.
Expand Down
11 changes: 10 additions & 1 deletion packages/stream_chat_flutter_core/lib/src/stream_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,16 @@ class StreamChannelState extends State<StreamChannel> {

// Load the channel at the last read message if available.
if (currentUserRead.lastReadMessageId case final lastReadMessageId?) {
return loadChannelAtMessage(lastReadMessageId);
try {
return await loadChannelAtMessage(lastReadMessageId);
} catch (e) {
// If the loadChannelAtMessage for any reason fails, we fallback to
// loading the channel at the last read date.
//
// One example of this is when the channel becomes too large and
// exceeds a certain threshold (I believe it's a 1000 members) it
// can't update the readstate anymore for each individual member.
}
}

// Otherwise, load the channel at the last read date.
Expand Down