From 066c71f32e2b6eaf8d47bca00380506582a148dc Mon Sep 17 00:00:00 2001 From: Doeunnkimm Date: Mon, 18 Mar 2024 01:14:32 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20optimistic=20update=ED=95=98=EB=8A=94?= =?UTF-8?q?=20=EA=B0=92=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/reactQuery/comment/useDeleteComment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/reactQuery/comment/useDeleteComment.ts b/src/hooks/reactQuery/comment/useDeleteComment.ts index 67a65906..255e9a21 100644 --- a/src/hooks/reactQuery/comment/useDeleteComment.ts +++ b/src/hooks/reactQuery/comment/useDeleteComment.ts @@ -23,7 +23,7 @@ export const useDeleteComment = () => { const updater = (old: CommentResponse): CommentResponse => { const updatedComment = old.comments.filter((comment) => comment.id !== commentId); - return { comments: updatedComment, commentCount: old.commentCount - 1 }; + return { ...old, comments: updatedComment, commentCount: old.commentCount - 1 }; }; const context = await optimisticUpdater({ queryKey: targetQueryKey, updater }); return context;