From d66f5c363bb45ae6a07b9462abdbbb2aeb3f1977 Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj Date: Wed, 6 Nov 2024 15:11:37 +0100 Subject: [PATCH] fix: check for channel validity before consuming config --- .../components/ChannelPreview/hooks/useLatestMessagePreview.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts b/package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts index da5899942..a1ef491b7 100644 --- a/package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +++ b/package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts @@ -298,7 +298,8 @@ export const useLatestMessagePreview = < useEffect(() => { if (channelConfigExists) { - const read_events = channel.getConfig()?.read_events; + const read_events = + !channel.disconnected && !!channel?.id && channel.getConfig()?.read_events; if (typeof read_events === 'boolean') { setReadEvents(read_events); }