diff --git a/ui/src/components/Comment/index.tsx b/ui/src/components/Comment/index.tsx index 1b4f0178..8bf98aae 100644 --- a/ui/src/components/Comment/index.tsx +++ b/ui/src/components/Comment/index.tsx @@ -35,7 +35,7 @@ const Comment = ({ objectId, mode, commentId }) => { page: pageIndex, page_size: pageSize, }); - const [comments, setComments] = useState(data?.list || []); + const [comments, setComments] = useState([]); const reportModal = useReportModal(); @@ -167,9 +167,8 @@ const Comment = ({ objectId, mode, commentId }) => { deleteComment(id).then(() => { if (pageIndex === 0) { mutate(); - } else { - setComments(comments.filter((item) => item.comment_id !== id)); } + setComments(comments.filter((item) => item.comment_id !== id)); }); }, });