mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 11:06:23 +00:00
fix: Closes #4 修复评论发布时之前的评论被移出列表的问题
This commit is contained in:
@ -71,7 +71,6 @@ export function CommentSection(
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
toast.success(t("comment_success"));
|
toast.success(t("comment_success"));
|
||||||
setTotalCommentCount(c => c + 1);
|
setTotalCommentCount(c => c + 1);
|
||||||
setComments(prevComments => prevComments.slice(0, -1));
|
|
||||||
getComment({ id: res.data.id }).then(response => {
|
getComment({ id: res.data.id }).then(response => {
|
||||||
console.log("New comment fetched:", response.data);
|
console.log("New comment fetched:", response.data);
|
||||||
setComments(prevComments => [response.data, ...prevComments]);
|
setComments(prevComments => [response.data, ...prevComments]);
|
||||||
|
Reference in New Issue
Block a user