From 9e6e256b70f27bb1a4f686b4db791b02cf6633f8 Mon Sep 17 00:00:00 2001 From: martincupela Date: Mon, 16 Sep 2024 14:23:36 +0200 Subject: [PATCH] fix: prevent calculating display name and image in channel preview on every re-render --- src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts b/src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts index 82ff8400d..aaa777245 100644 --- a/src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts +++ b/src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts @@ -23,10 +23,10 @@ export const useChannelPreviewInfo = < const { client } = useChatContext('useChannelPreviewInfo'); const [displayTitle, setDisplayTitle] = useState( - overrideTitle || getDisplayTitle(channel, client.user), + () => overrideTitle || getDisplayTitle(channel, client.user), ); const [displayImage, setDisplayImage] = useState( - overrideImage || getDisplayImage(channel, client.user), + () => overrideImage || getDisplayImage(channel, client.user), ); useEffect(() => {