fix(IOS-INFO-041): load KB info on appear + fix initial loading state

- Set isLoadingSources = true initially to show spinner
- Load KnowledgeBase detail in appear() for header
- Prevents blank screen before data loads

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-06-18 22:09:47 +08:00
parent 5008e491a9
commit f7d10f3f44

View File

@ -144,13 +144,15 @@ struct LibraryDetailPage: View {
@State private var detailTab = 1
private func appear() async {
// Load KB info and sources
viewModel.knowledgeBase = try? await KnowledgeBaseService.shared.detail(id: knowledgeBaseId)
await loadSources()
}
@State private var sortOption = 0
@State private var showFolderManager = false
@State private var sources: [KnowledgeSource] = []
@State private var sourceReadingStatus: [String: String] = [:]
@State private var isLoadingSources = false
@State private var isLoadingSources = true
private var allSelected: Bool {
!viewModel.items.isEmpty && selectedIds.count == viewModel.items.count