A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: solve the problem that comments cannot be deleted
robin4a40f77c56ce
diff --git a/ui/src/components/Comment/index.tsx b/ui/src/components/Comment/index.tsxindex 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<any>(data?.list || []);+ const [comments, setComments] = useState<any>([]);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));});},});