diff --git a/ui/src/components/Comment/index.tsx b/ui/src/components/Comment/index.tsx index af2ddbd4f..b294c2e13 100644 --- a/ui/src/components/Comment/index.tsx +++ b/ui/src/components/Comment/index.tsx @@ -311,10 +311,13 @@ const Comment: FC = ({ objectId, mode, commentId, children }) => { setComments( comments.map((item) => { if (item.comment_id === id) { - item.vote_count = is_cancel - ? item.vote_count - 1 - : item.vote_count + 1; - item.is_vote = !is_cancel; + return { + ...item, + vote_count: is_cancel + ? item.vote_count - 1 + : item.vote_count + 1, + is_vote: !is_cancel, + }; } return item; }),