fix: handle invalid channels even when sidebar is closed

This commit is contained in:
Paul
2021-12-25 13:20:20 +00:00
parent d7f52fb6f4
commit 56126fa303
2 changed files with 18 additions and 13 deletions

View File

@@ -59,15 +59,6 @@ export default observer(() => {
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 (
<Redirect
to={`/server/${server_id}/channel/${server.channel_ids[0]}`}
/>
);
if (channel_id && !channel) return <Redirect to={`/server/${server_id}`} />;
// ! FIXME: move this globally
// Track which channel the user was last on.
useEffect(() => {