fix(sns): derive per-user totals from timeline counts map

This commit is contained in:
aits2026
2026-03-05 17:44:24 +08:00
parent 38af8de469
commit 3388b7a122
5 changed files with 80 additions and 50 deletions

View File

@@ -497,11 +497,12 @@ export default function SnsPage() {
setAuthorTimelineTotalPosts(null)
try {
const result = await window.electronAPI.sns.getUserPostStats(target.username)
const result = await window.electronAPI.sns.getUserPostCounts()
if (requestToken !== authorTimelineStatsTokenRef.current) return
if (result.success && result.data) {
setAuthorTimelineTotalPosts(Math.max(0, Number(result.data.totalPosts || 0)))
if (result.success && result.counts) {
const totalPosts = result.counts[target.username] ?? 0
setAuthorTimelineTotalPosts(Math.max(0, Number(totalPosts || 0)))
} else {
setAuthorTimelineTotalPosts(null)
}