From 9e658662cb823f4f7b2c0797911c3c51014ec03e Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 11 Jun 2026 14:33:13 +0800 Subject: [PATCH] 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. --- src/components/comments/section.rs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/comments/section.rs b/src/components/comments/section.rs index de0570e..a52e4e0 100644 --- a/src/components/comments/section.rs +++ b/src/components/comments/section.rs @@ -33,15 +33,20 @@ pub fn CommentSection(post_id: i32) -> Element { if ids.is_empty() { return; } - if let Ok(statuses) = check_pending_status(ids).await { - let to_remove: Vec = statuses - .into_iter() - .filter(|s| s.status != "pending") - .map(|s| s.id) - .collect(); - if !to_remove.is_empty() { - comment_storage::remove_pending_ids(post_id, &to_remove); - pending.write().retain(|c| !to_remove.contains(&c.id)); + match check_pending_status(ids).await { + Ok(statuses) => { + let to_remove: Vec = statuses + .into_iter() + .filter(|s| s.status != "pending") + .map(|s| s.id) + .collect(); + if !to_remove.is_empty() { + 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); } } }