From 55a7b009542c3140d6ab4ae514173acbb4f7a19b Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Tue, 7 Sep 2021 21:40:46 +0200 Subject: [PATCH] fix: choose the first channel in the server if none is selected --- src/components/navigation/left/ServerSidebar.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/navigation/left/ServerSidebar.tsx b/src/components/navigation/left/ServerSidebar.tsx index 61fca6b3..ad4b1d28 100644 --- a/src/components/navigation/left/ServerSidebar.tsx +++ b/src/components/navigation/left/ServerSidebar.tsx @@ -62,7 +62,11 @@ const ServerSidebar = observer((props: Props) => { if (!server) return ; const channel = channel_id ? client.channels.get(channel_id) : undefined; + + // The user selected no channel, let's see if there's a channel available + if (!channel && server.channel_ids.length > 0) return ; if (channel_id && !channel) return ; + if (channel) useUnreads({ ...props, channel }); useEffect(() => {