debug: add logging to LibraryDetailPage loadSources + appear
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
c5ce70fa5a
commit
c0b7dda8c6
@ -144,9 +144,11 @@ struct LibraryDetailPage: View {
|
||||
@State private var detailTab = 1
|
||||
|
||||
private func appear() async {
|
||||
// Load KB info and sources
|
||||
print("[LibraryDetail] appear() START, kbId=\(knowledgeBaseId)")
|
||||
viewModel.knowledgeBase = try? await KnowledgeBaseService.shared.detail(id: knowledgeBaseId)
|
||||
print("[LibraryDetail] KB loaded: \(viewModel.knowledgeBase?.title ?? "nil")")
|
||||
await loadSources()
|
||||
print("[LibraryDetail] appear() DONE")
|
||||
}
|
||||
@State private var sortOption = 0
|
||||
@State private var showFolderManager = false
|
||||
@ -640,16 +642,16 @@ struct LibraryDetailPage: View {
|
||||
|
||||
private func loadSources() async {
|
||||
isLoadingSources = true
|
||||
do { sources = try await KnowledgeSourceService.shared.list(kbId: knowledgeBaseId) } catch {}
|
||||
// Fetch reading status for sources
|
||||
for src in sources.prefix(20) {
|
||||
if let progress = try? await ReadingAPIService.shared.getReadingProgress(
|
||||
materialId: src.id, targetType: "knowledge_source"
|
||||
) {
|
||||
sourceReadingStatus[src.id] = progress.isMarkedRead ? "read" : progress.status
|
||||
} else if MarkedReadStore.shared.contains(src.id) {
|
||||
sourceReadingStatus[src.id] = "read"
|
||||
print("[LibraryDetail] loadSources START, kbId=\(knowledgeBaseId)")
|
||||
do {
|
||||
sources = try await KnowledgeSourceService.shared.list(kbId: knowledgeBaseId)
|
||||
print("[LibraryDetail] loadSources OK, count=\(sources.count)")
|
||||
for src in sources {
|
||||
print("[LibraryDetail] source: id=\(src.id), title=\(src.title ?? "-"), parseStatus=\(src.parseStatus ?? "-")")
|
||||
}
|
||||
} catch {
|
||||
print("[LibraryDetail] loadSources ERROR: \(error.localizedDescription)")
|
||||
print("[LibraryDetail] Full error: \(error)")
|
||||
}
|
||||
isLoadingSources = false
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user