Skip to content

Commit

Permalink
Merge pull request #190 from TheUpperPart/Fix/#188
Browse files Browse the repository at this point in the history
Fix: 새로고침 시 채널 보드 바가 보이지 않는 문제 해결
  • Loading branch information
pp449 authored Oct 26, 2023
2 parents 89a1b99 + 044d585 commit 79eb673
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PropsWithChildren, useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import styled from '@emotion/styled';

import ChannelBar from '@components/Sidebar/ChannelBar/ChannelBar';
Expand All @@ -9,8 +8,6 @@ import Header from '@components/Header/Header';
import useChannels from '@hooks/useChannels';

const Layout = ({ children }: PropsWithChildren) => {
const router = useRouter();

const { channels } = useChannels();
const [selectedChannelLink, setSelectedChannelLink] = useState<string | null>(null);

Expand All @@ -20,7 +17,7 @@ const Layout = ({ children }: PropsWithChildren) => {

useEffect(() => {
// 새로고침시 첫 번째 채널 보여주도록 설정
if (channels && router.asPath === '/') {
if (channels) {
channels.length !== 0 && setSelectedChannelLink(channels[0].channelLink);
}
}, [channels]);
Expand Down

0 comments on commit 79eb673

Please sign in to comment.