From f7d10f3f443c9594a16a11a3c9a3a31b31b14a57 Mon Sep 17 00:00:00 2001 From: wangdl Date: Thu, 18 Jun 2026 22:09:47 +0800 Subject: [PATCH] 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 --- AIStudyApp/AIStudyApp/Features/Library/LibrarySubpages.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AIStudyApp/AIStudyApp/Features/Library/LibrarySubpages.swift b/AIStudyApp/AIStudyApp/Features/Library/LibrarySubpages.swift index 54cc59b..ae80d7c 100644 --- a/AIStudyApp/AIStudyApp/Features/Library/LibrarySubpages.swift +++ b/AIStudyApp/AIStudyApp/Features/Library/LibrarySubpages.swift @@ -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