diff --git a/src/components/navigation/left/ServerSidebar.tsx b/src/components/navigation/left/ServerSidebar.tsx
index 6481caf8..e42b39b6 100644
--- a/src/components/navigation/left/ServerSidebar.tsx
+++ b/src/components/navigation/left/ServerSidebar.tsx
@@ -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 (
-
- );
- if (channel_id && !channel) return ;
-
// ! FIXME: move this globally
// Track which channel the user was last on.
useEffect(() => {
diff --git a/src/pages/channels/Channel.tsx b/src/pages/channels/Channel.tsx
index dbf1fc7c..b177463f 100644
--- a/src/pages/channels/Channel.tsx
+++ b/src/pages/channels/Channel.tsx
@@ -2,7 +2,7 @@ import { Hash } from "@styled-icons/boxicons-regular";
import { Ghost } from "@styled-icons/boxicons-solid";
import { reaction } from "mobx";
import { observer } from "mobx-react-lite";
-import { useParams } from "react-router-dom";
+import { Redirect, useParams } from "react-router-dom";
import { Channel as ChannelI } from "revolt.js/dist/maps/Channels";
import styled from "styled-components";
@@ -93,9 +93,21 @@ const PlaceholderBase = styled.div`
}
`;
-export function Channel({ id }: { id: string }) {
+export function Channel({ id, server_id }: { id: string; server_id: string }) {
const client = useClient();
const channel = client.channels.get(id);
+
+ if (server_id && !channel) {
+ const server = client.servers.get(server_id);
+ if (server && server.channel_ids.length > 0) {
+ return (
+
+ );
+ }
+ }
+
if (!channel) return ;
if (channel.channel_type === "VoiceChannel") {
@@ -198,6 +210,8 @@ function ChannelPlaceholder() {
}
export default function ChannelComponent() {
- const { channel } = useParams<{ channel: string }>();
- return ;
+ const { channel, server } =
+ useParams<{ channel: string; server: string }>();
+
+ return ;
}