Skip to content

Commit

Permalink
Merge pull request #269 from TheUpperPart/Fix/#268
Browse files Browse the repository at this point in the history
Fix: 메인페이지 재요청 하도록 변경
  • Loading branch information
navyjeongs authored Dec 7, 2023
2 parents ccd472d + f193134 commit 417c5f3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pages/contents/[channelLink]/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,22 @@ const Main = () => {
const { channelPermission } = useChannels();
const channelLink = router.query.channelLink;

const { data, isSuccess } = useQuery<MainContent | undefined>(
const { data, isSuccess, refetch } = useQuery<MainContent | undefined>(
['getMainContents', channelLink],
() => {
return fetchData(channelLink as string);
},
{ staleTime: 0, cacheTime: 0 },
);

useEffect(() => {
if (isSuccess && data) setMainContents(data);
}, [isSuccess]);

useEffect(() => {
refetch();
}, [router.query.channelLink as string]);

const handleContentUpdate = async (updatedContent: MainContent) => {
if (!channelLink) return;

Expand Down

0 comments on commit 417c5f3

Please sign in to comment.