feat: display accurate total in tag detail page

This commit is contained in:
xfy 2026-06-10 14:25:54 +08:00
parent 2ade51bd0f
commit 4015412b41

View File

@ -85,16 +85,16 @@ fn TagDetailContent(tag: String) -> Element {
let posts_res = use_server_future(move || get_posts_by_tag(tag.clone()))?; let posts_res = use_server_future(move || get_posts_by_tag(tag.clone()))?;
let posts_data = posts_res.read().as_ref().map(|r| match r { let posts_data = posts_res.read().as_ref().map(|r| match r {
Ok(PostListResponse { posts }) => Ok(posts.clone()), Ok(PostListResponse { posts, total }) => Ok((posts.clone(), *total)),
Err(e) => Err(e.to_string()), Err(e) => Err(e.to_string()),
}); });
match posts_data { match posts_data {
Some(Ok(posts)) => { Some(Ok((posts, total))) => {
rsx! { rsx! {
div { class: "mt-2 text-base text-gray-500 dark:text-[#9b9c9d]", div { class: "mt-2 text-base text-gray-500 dark:text-[#9b9c9d]",
"" ""
span { class: "font-medium text-gray-700 dark:text-[#dadadb]", "{posts.len()}" } span { class: "font-medium text-gray-700 dark:text-[#dadadb]", "{total}" }
" 篇文章" " 篇文章"
} }
for post in posts.iter() { for post in posts.iter() {