Skip to content

Commit 952612a

Browse files
authored
fix: prevent setting unread UI state for channel non-members (#2757)
1 parent adeb0e7 commit 952612a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/Channel/Channel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,9 @@ const ChannelInner = (
382382
);
383383
} else {
384384
const markReadResponse = await channel.markRead();
385-
if (updateChannelUiUnreadState && markReadResponse) {
385+
// markReadResponse.event can be null in case of a user that is not a member of a channel being marked read
386+
// in that case event is null and we should not set unread UI
387+
if (updateChannelUiUnreadState && markReadResponse?.event) {
386388
_setChannelUnreadUiState({
387389
last_read: lastRead.current,
388390
last_read_message_id: markReadResponse.event.last_read_message_id,

0 commit comments

Comments
 (0)