fix-page-config-reload-empty

This commit is contained in:
mediabot-pt
2026-07-06 12:14:38 +08:00
parent 9207039046
commit 7042149a13
2 changed files with 9 additions and 4 deletions

View File

@@ -151,7 +151,8 @@ const fetchAll = async () => {
const pages = pr.status==='fulfilled' ? (pr.value?.data||pr.value||[]) : []
const map = {}
for (const p of pages) {
const entries = (() => { try { return JSON.parse(p.entriesJson||'[]') } catch {return []} })()
const parsed = (() => { try { return JSON.parse(p.entriesJson||'{}') } catch {return {}} })()
const entries = Array.isArray(parsed) ? parsed : (parsed.entries || [])
if (!map[p.siteId] || p.version > map[p.siteId].version)
map[p.siteId] = { version: p.version, entryCount: entries.length, updatedAt: p.updatedAt, entriesJson: p.entriesJson }
}