mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
fix(sns): derive per-user totals from timeline counts map
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
1
src/types/electron.d.ts
vendored
1
src/types/electron.d.ts
vendored
@@ -789,6 +789,7 @@ export interface ElectronAPI {
|
||||
onExportProgress: (callback: (payload: { current: number; total: number; status: string }) => void) => () => void
|
||||
selectExportDir: () => Promise<{ canceled: boolean; filePath?: string }>
|
||||
getSnsUsernames: () => Promise<{ success: boolean; usernames?: string[]; error?: string }>
|
||||
getUserPostCounts: () => Promise<{ success: boolean; counts?: Record<string, number>; error?: string }>
|
||||
getExportStatsFast: () => Promise<{ success: boolean; data?: { totalPosts: number; totalFriends: number; myPosts: number | null }; error?: string }>
|
||||
getExportStats: () => Promise<{ success: boolean; data?: { totalPosts: number; totalFriends: number; myPosts: number | null }; error?: string }>
|
||||
getUserPostStats: (username: string) => Promise<{ success: boolean; data?: { username: string; totalPosts: number }; error?: string }>
|
||||
|
||||
Reference in New Issue
Block a user