fix: resolve WASM compilation errors

- 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
This commit is contained in:
xfy 2026-06-11 14:55:10 +08:00
parent aa68dc4c55
commit 2b36a7c669
2 changed files with 5 additions and 3 deletions

View File

@ -45,8 +45,8 @@ pub fn CommentSection(post_id: i32) -> Element {
pending.write().retain(|c| !to_remove.contains(&c.id)); pending.write().retain(|c| !to_remove.contains(&c.id));
} }
} }
Err(e) => { Err(_e) => {
tracing::warn!("check_pending_status failed: {}", e); // Silently ignore on WASM; server-only logging not available
} }
} }
} }

View File

@ -1,4 +1,4 @@
use chrono::{DateTime, Utc}; use chrono::DateTime;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
const AUTHOR_KEY: &str = "yggdrasil-comment-author"; const AUTHOR_KEY: &str = "yggdrasil-comment-author";
@ -28,6 +28,7 @@ pub struct PendingComment {
type PendingMap = std::collections::HashMap<String, Vec<PendingComment>>; type PendingMap = std::collections::HashMap<String, Vec<PendingComment>>;
#[allow(unused_variables)]
fn read_storage(key: &str) -> Option<String> { fn read_storage(key: &str) -> Option<String> {
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
{ {
@ -41,6 +42,7 @@ fn read_storage(key: &str) -> Option<String> {
} }
} }
#[allow(unused_variables)]
fn write_storage(key: &str, value: &str) { fn write_storage(key: &str, value: &str) {
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
{ {