diff --git a/src/screens/detailedPost/CommentList.tsx b/src/screens/detailedPost/CommentList.tsx
index 525876b..b5e177c 100644
--- a/src/screens/detailedPost/CommentList.tsx
+++ b/src/screens/detailedPost/CommentList.tsx
@@ -28,7 +28,12 @@ const CommentList = ({ insightId, authorId, handleReplyClick, commentList }: Com
onReply={() => handleReplyClick({ id: item.id, nickname: item.writer?.name ?? '' })}
commentId={item.id}
/>
-
+
>
))}
>
diff --git a/src/screens/detailedPost/ReplyList.tsx b/src/screens/detailedPost/ReplyList.tsx
index 1979e6d..296ce2a 100644
--- a/src/screens/detailedPost/ReplyList.tsx
+++ b/src/screens/detailedPost/ReplyList.tsx
@@ -6,16 +6,17 @@ import { Pressable, View, Text } from 'react-native';
import { SvgXml } from 'react-native-svg';
import CommentXml from '../../constants/Icons/Comment/CommentXml';
-const REPLY_LIMIT = 10;
+const REPLY_LIMIT = 5;
interface ReplyListProps {
insightId: number;
parentId: number;
authorId: number;
+ totalReply: number;
}
-const ReplyList = ({ insightId, parentId, authorId }: ReplyListProps) => {
- const { data, fetchNextPage, hasNextPage } = useInfiniteQuery({
+const ReplyList = ({ insightId, parentId, authorId, totalReply }: ReplyListProps) => {
+ const { data, fetchNextPage } = useInfiniteQuery({
queryKey: InsightQueryKeys.getReplies({
insightId,
parentId,
@@ -28,6 +29,10 @@ const ReplyList = ({ insightId, parentId, authorId }: ReplyListProps) => {
},
});
+ const totalCount = data?.pages.reduce((accumulator, currentArray) => {
+ return accumulator + (currentArray?.length ?? 0);
+ }, 0);
+
return (
{data?.pages?.flatMap((page) =>
@@ -46,7 +51,7 @@ const ReplyList = ({ insightId, parentId, authorId }: ReplyListProps) => {
/>
)),
)}
- {hasNextPage && (
+ {totalCount !== totalReply && (
fetchNextPage()}