Skip to content

Commit

Permalink
chore: optimistic update하는 값 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Doeunnkimm committed Mar 17, 2024
1 parent 6d6258d commit 066c71f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/reactQuery/comment/useDeleteComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 066c71f

Please sign in to comment.