Skip to content

Commit

Permalink
fix: prevent calculating display name and image in channel preview on…
Browse files Browse the repository at this point in the history
… every re-render
  • Loading branch information
MartinCupela committed Sep 16, 2024
1 parent dfba1ed commit 9e6e256
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const useChannelPreviewInfo = <

const { client } = useChatContext<StreamChatGenerics>('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(() => {
Expand Down

0 comments on commit 9e6e256

Please sign in to comment.