Merge branch 'feat/ui-1.0.3' of git.backyard.segmentfault.com:opensource/answer into feat/ui-1.0.3

This commit is contained in:
haitao(lj) 2023-01-09 17:43:10 +08:00
commit 2e7e4806d1
1 changed files with 2 additions and 3 deletions

View File

@ -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));
});
},
});