debug: add article open + webView load timing to Reader logging
This commit is contained in:
@@ -59,12 +59,16 @@ struct ArticleView: View {
|
||||
}
|
||||
}
|
||||
.task {
|
||||
let t0 = CFAbsoluteTimeGetCurrent()
|
||||
let entryId = entry.id
|
||||
print("[READER-DBG] 📄 article OPEN id=\(entryId) initContent=\(articleContent.count)")
|
||||
|
||||
if let idx = vm.entries.firstIndex(where: { $0.id == entryId }),
|
||||
!vm.entries[idx].isRead {
|
||||
vm.entries[idx].status = "read"
|
||||
}
|
||||
currentEntry = vm.entries.first(where: { $0.id == entryId }) ?? currentEntry
|
||||
print("[READER-DBG] 📄 markRead done +\(Int((CFAbsoluteTimeGetCurrent()-t0)*1000))ms")
|
||||
|
||||
Task {
|
||||
let api = ReaderAPI()
|
||||
@@ -74,10 +78,12 @@ struct ArticleView: View {
|
||||
|
||||
do {
|
||||
let fullEntry = try await ReaderAPI().getEntry(id: entryId)
|
||||
print("[READER-DBG] 📄 getEntry +\(Int((CFAbsoluteTimeGetCurrent()-t0)*1000))ms contentLen=\(fullEntry.articleHTML.count)")
|
||||
let fullHTML = fullEntry.articleHTML
|
||||
|
||||
if !fullHTML.isEmpty && fullHTML.count > articleContent.count {
|
||||
articleContent = fullHTML
|
||||
print("[READER-DBG] 📄 content upgraded +\(Int((CFAbsoluteTimeGetCurrent()-t0)*1000))ms")
|
||||
}
|
||||
|
||||
var merged = fullEntry
|
||||
@@ -86,7 +92,10 @@ struct ArticleView: View {
|
||||
merged.starred = local.starred
|
||||
}
|
||||
currentEntry = merged
|
||||
} catch {}
|
||||
print("[READER-DBG] 📄 article READY +\(Int((CFAbsoluteTimeGetCurrent()-t0)*1000))ms")
|
||||
} catch {
|
||||
print("[READER-DBG] 📄 article FAILED +\(Int((CFAbsoluteTimeGetCurrent()-t0)*1000))ms error=\(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ struct ArticleWebView: UIViewRepresentable {
|
||||
|
||||
// Only reload if content meaningfully changed
|
||||
guard context.coordinator.lastHTML != newHTML else { return }
|
||||
print("[READER-DBG] 🌐 webView load htmlLen=\(newHTML.count) isUpgrade=\(context.coordinator.lastHTML != nil)")
|
||||
|
||||
let isUpgrade = context.coordinator.lastHTML != nil
|
||||
context.coordinator.lastHTML = newHTML
|
||||
|
||||
Reference in New Issue
Block a user