From bdc7fcd90b5cfe139275002626f549dfbe39ec32 Mon Sep 17 00:00:00 2001 From: TaeeunKim Date: Mon, 16 Oct 2023 15:04:23 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=8C=93=EA=B8=80=EC=9D=B4=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20id=EB=A5=BC=20=EC=9D=BD?= =?UTF-8?q?=EC=96=B4=EC=98=AC=20=EC=88=98=20=EC=97=86=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/hooks/queries/recipe/useInfiniteRecipeCommentQuery.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/hooks/queries/recipe/useInfiniteRecipeCommentQuery.ts b/frontend/src/hooks/queries/recipe/useInfiniteRecipeCommentQuery.ts index ec251f9b5..dd870941b 100644 --- a/frontend/src/hooks/queries/recipe/useInfiniteRecipeCommentQuery.ts +++ b/frontend/src/hooks/queries/recipe/useInfiniteRecipeCommentQuery.ts @@ -27,7 +27,7 @@ const useInfiniteRecipeCommentQuery = (recipeId: number) => { ({ pageParam = { lastId: 0, totalElements: null } }) => fetchRecipeComments(pageParam, recipeId), { getNextPageParam: (prevResponse: CommentResponse) => { - const lastId = prevResponse.comments[prevResponse.comments.length - 1].id; + const lastId = prevResponse.comments.length ? prevResponse.comments[prevResponse.comments.length - 1].id : 0; const totalElements = prevResponse.totalElements; const lastCursor = { lastId: lastId, totalElements: totalElements }; return prevResponse.hasNext ? lastCursor : undefined;