diff --git a/src/app/vote/[slug]/_component/VoteDetail.tsx b/src/app/vote/[slug]/_component/VoteDetail.tsx
index 7222ce0..30660c5 100644
--- a/src/app/vote/[slug]/_component/VoteDetail.tsx
+++ b/src/app/vote/[slug]/_component/VoteDetail.tsx
@@ -1,6 +1,6 @@
'use client';
-import { notFound } from 'next/navigation';
+import { Suspense } from 'react';
import { Button } from '@/components/common/button';
import { Icon } from '@/components/common/icon';
@@ -17,61 +17,61 @@ type Props = {
};
const VoteDetail = ({ voteId }: Props) => {
- const { status, data } = useGetVoteById(voteId);
+ const { data } = useGetVoteById(voteId);
const { mutate: toggleLike } = useLikeVoteMutation();
return (
- {status === 'pending' ? (
-
-
-
- ) : status === 'error' ? (
- notFound()
- ) : (
- <>
-
+ }>
+
-
- Q. {data.title}
-
-
- {data.content}
-
+
+ Q. {data.title}
+
+
+ {data.content}
+
-
-
+
+
-
-
+
+
-
- toggleLike({ voteId })}
- />
- }
- variant="empty"
- className="!p-0"
- />
-
- >
- )}
+
+ toggleLike({ voteId })}
+ />
+ }
+ variant="empty"
+ className="!p-0"
+ />
+
+
);
};
+const VoteDetailFallback = () => {
+ return (
+
+
+
+ );
+};
+
export default VoteDetail;
diff --git a/src/app/vote/[slug]/page.tsx b/src/app/vote/[slug]/page.tsx
index ed7ba20..a1de7e5 100644
--- a/src/app/vote/[slug]/page.tsx
+++ b/src/app/vote/[slug]/page.tsx
@@ -6,14 +6,14 @@ type Props = {
params: { slug: string };
};
-const VoteDetailPage = async ({ params }: Props) => {
- const voteId = params.slug;
+const VoteDetailPage = ({ params }: Props) => {
+ const voteId = +params.slug;
return (
<>
-
+
-
+
>
);
};
diff --git a/src/hooks/test/useGetMyTest.ts b/src/hooks/test/useGetMyTest.ts
index ca641ff..56dccf7 100644
--- a/src/hooks/test/useGetMyTest.ts
+++ b/src/hooks/test/useGetMyTest.ts
@@ -1,10 +1,10 @@
-import { useQuery } from '@tanstack/react-query';
+import { useSuspenseQuery } from '@tanstack/react-query';
import { donworryApi } from '@/api';
import { queryKey } from '@/api/queryKey';
const useGetMyTest = () => {
- return useQuery({
+ return useSuspenseQuery({
queryKey: queryKey.test.myResult,
queryFn: donworryApi.test.getMyTest,
});
diff --git a/src/hooks/vote/useGetMyVote.ts b/src/hooks/vote/useGetMyVote.ts
index 4f0f2c9..d4b6f65 100644
--- a/src/hooks/vote/useGetMyVote.ts
+++ b/src/hooks/vote/useGetMyVote.ts
@@ -1,10 +1,10 @@
-import { useQuery } from '@tanstack/react-query';
+import { useSuspenseQuery } from '@tanstack/react-query';
import { donworryApi } from '@/api';
import { queryKey } from '@/api/queryKey';
const useGetMyVote = () => {
- return useQuery({
+ return useSuspenseQuery({
queryFn: donworryApi.vote.getMyVotes,
queryKey: queryKey.vote.myVotes(),
retry: 1,
diff --git a/src/hooks/vote/useGetVoteById.ts b/src/hooks/vote/useGetVoteById.ts
index 8e78a26..9de71a4 100644
--- a/src/hooks/vote/useGetVoteById.ts
+++ b/src/hooks/vote/useGetVoteById.ts
@@ -1,10 +1,10 @@
-import { useQuery } from '@tanstack/react-query';
+import { useSuspenseQuery } from '@tanstack/react-query';
import { donworryApi } from '@/api';
import { queryKey } from '@/api/queryKey';
export const useGetVoteById = (voteId: number) => {
- return useQuery({
+ return useSuspenseQuery({
queryKey: queryKey.vote.detail(voteId),
queryFn: () => donworryApi.vote.getVoteById({ voteId }),
});
diff --git a/src/hooks/vote/useGetVoteReplies.ts b/src/hooks/vote/useGetVoteReplies.ts
index ba8c0c8..d851a3c 100644
--- a/src/hooks/vote/useGetVoteReplies.ts
+++ b/src/hooks/vote/useGetVoteReplies.ts
@@ -1,11 +1,11 @@
-import { useQuery } from '@tanstack/react-query';
+import { useSuspenseQuery } from '@tanstack/react-query';
import { donworryApi } from '@/api';
import { queryKey } from '@/api/queryKey';
import { GetVoteRepliesRequest } from '@/api/vote/types';
const useGetVoteReplies = ({ voteId }: GetVoteRepliesRequest) => {
- return useQuery({
+ return useSuspenseQuery({
queryKey: queryKey.vote.reply(voteId),
queryFn: () => donworryApi.vote.getVoteReplies({ voteId }),
});