From c88d540b881aab439dadf76e7b88206e07c67212 Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Mon, 24 Apr 2023 19:57:40 +0700 Subject: [PATCH] temp fix channel list --- src/components/channels/channelList.tsx | 12 ++++++++++-- src/components/navigation.tsx | 5 ++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/channels/channelList.tsx b/src/components/channels/channelList.tsx index f7d97906..5c2c4c36 100644 --- a/src/components/channels/channelList.tsx +++ b/src/components/channels/channelList.tsx @@ -1,12 +1,20 @@ import { ChannelListItem } from '@components/channels/channelListItem'; import { CreateChannelModal } from '@components/channels/createChannelModal'; -import { channelsAtom } from '@stores/channel'; +import { channelsAtom, defaultChannelsAtom } from '@stores/channel'; import { useAtomValue } from 'jotai'; export default function ChannelList() { - const list = useAtomValue(channelsAtom); + let atom; + + if (typeof window !== 'undefined') { + atom = channelsAtom; + } else { + atom = defaultChannelsAtom; + } + + const list: any = useAtomValue(atom); return (
diff --git a/src/components/navigation.tsx b/src/components/navigation.tsx index 4ef4b77f..43c2fb66 100644 --- a/src/components/navigation.tsx +++ b/src/components/navigation.tsx @@ -1,13 +1,12 @@ import ActiveLink from '@components/activeLink'; +import ChannelList from '@components/channels/channelList'; import ChatList from '@components/chats/chatList'; import { Disclosure } from '@headlessui/react'; import { Bonfire, NavArrowUp, PeopleTag } from 'iconoir-react'; -import { Suspense, lazy } from 'react'; +import { Suspense } from 'react'; import Skeleton from 'react-loading-skeleton'; -const ChannelList = lazy(() => import('@components/channels/channelList')); - export default function Navigation() { return (