From 2b36a7c669509390094d47b6c3a515e8b47409b1 Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 11 Jun 2026 14:55:10 +0800 Subject: [PATCH] fix: resolve WASM compilation errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove tracing::warn! (tracing not available in WASM builds) - Fix parameter names in comment_storage: _key → key, _value → value - Add #[allow(unused_variables)] for non-WASM builds where params are unused --- src/components/comments/section.rs | 4 ++-- src/hooks/comment_storage.rs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/comments/section.rs b/src/components/comments/section.rs index 020a7f9..47a30f1 100644 --- a/src/components/comments/section.rs +++ b/src/components/comments/section.rs @@ -45,8 +45,8 @@ pub fn CommentSection(post_id: i32) -> Element { pending.write().retain(|c| !to_remove.contains(&c.id)); } } - Err(e) => { - tracing::warn!("check_pending_status failed: {}", e); + Err(_e) => { + // Silently ignore on WASM; server-only logging not available } } } diff --git a/src/hooks/comment_storage.rs b/src/hooks/comment_storage.rs index 448312c..dd59dbb 100644 --- a/src/hooks/comment_storage.rs +++ b/src/hooks/comment_storage.rs @@ -1,4 +1,4 @@ -use chrono::{DateTime, Utc}; +use chrono::DateTime; use serde::{Deserialize, Serialize}; const AUTHOR_KEY: &str = "yggdrasil-comment-author"; @@ -28,6 +28,7 @@ pub struct PendingComment { type PendingMap = std::collections::HashMap>; +#[allow(unused_variables)] fn read_storage(key: &str) -> Option { #[cfg(target_arch = "wasm32")] { @@ -41,6 +42,7 @@ fn read_storage(key: &str) -> Option { } } +#[allow(unused_variables)] fn write_storage(key: &str, value: &str) { #[cfg(target_arch = "wasm32")] {