fix(comments): add error logging for check_pending_status failure
Address code quality review: log warnings when the server call fails instead of silently swallowing the error.
This commit is contained in:
parent
40cfd44d3a
commit
9e658662cb
@ -33,15 +33,20 @@ pub fn CommentSection(post_id: i32) -> Element {
|
|||||||
if ids.is_empty() {
|
if ids.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let Ok(statuses) = check_pending_status(ids).await {
|
match check_pending_status(ids).await {
|
||||||
let to_remove: Vec<i64> = statuses
|
Ok(statuses) => {
|
||||||
.into_iter()
|
let to_remove: Vec<i64> = statuses
|
||||||
.filter(|s| s.status != "pending")
|
.into_iter()
|
||||||
.map(|s| s.id)
|
.filter(|s| s.status != "pending")
|
||||||
.collect();
|
.map(|s| s.id)
|
||||||
if !to_remove.is_empty() {
|
.collect();
|
||||||
comment_storage::remove_pending_ids(post_id, &to_remove);
|
if !to_remove.is_empty() {
|
||||||
pending.write().retain(|c| !to_remove.contains(&c.id));
|
comment_storage::remove_pending_ids(post_id, &to_remove);
|
||||||
|
pending.write().retain(|c| !to_remove.contains(&c.id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
tracing::warn!("check_pending_status failed: {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user