diff --git a/src/components/comments/list.rs b/src/components/comments/list.rs index 194eb9d..792bf11 100644 --- a/src/components/comments/list.rs +++ b/src/components/comments/list.rs @@ -46,12 +46,16 @@ pub fn CommentList( rsx! { div { class: "space-y-0 divide-y divide-gray-100 dark:divide-[#2a2a2a]", for item in merged { + let key_id = match &item { + MergedComment::Approved(c) => c.id, + MergedComment::Pending(c) => c.id, + }; match item { MergedComment::Approved(comment) => rsx! { - CommentItem { comment, post_id } + CommentItem { key: "{key_id}", comment, post_id } }, MergedComment::Pending(comment) => rsx! { - PendingCommentItem { comment, post_id } + PendingCommentItem { key: "{key_id}", comment, post_id } }, } } diff --git a/src/components/comments/pending_item.rs b/src/components/comments/pending_item.rs index 7deedac..30f1bb2 100644 --- a/src/components/comments/pending_item.rs +++ b/src/components/comments/pending_item.rs @@ -3,8 +3,7 @@ use dioxus::prelude::*; use crate::hooks::comment_storage::{PendingComment, render_pending_content}; #[component] -pub fn PendingCommentItem(comment: PendingComment, post_id: i32) -> Element { - let _ = post_id; +pub fn PendingCommentItem(comment: PendingComment, _post_id: i32) -> Element { let depth = if comment.parent_id.is_none() && comment.depth > 0 { 0