From 9e0e0f9201ceccde340df02b2b34dbb6a0988f83 Mon Sep 17 00:00:00 2001 From: martincupela Date: Fri, 4 Jul 2025 11:24:47 +0200 Subject: [PATCH] fix: prevent setting unread UI state for channel non-members --- src/components/Channel/Channel.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Channel/Channel.tsx b/src/components/Channel/Channel.tsx index b4ac09b549..844274cb52 100644 --- a/src/components/Channel/Channel.tsx +++ b/src/components/Channel/Channel.tsx @@ -382,7 +382,9 @@ const ChannelInner = ( ); } else { const markReadResponse = await channel.markRead(); - if (updateChannelUiUnreadState && markReadResponse) { + // markReadResponse.event can be null in case of a user that is not a member of a channel being marked read + // in that case event is null and we should not set unread UI + if (updateChannelUiUnreadState && markReadResponse?.event) { _setChannelUnreadUiState({ last_read: lastRead.current, last_read_message_id: markReadResponse.event.last_read_message_id,