Select items after load

This commit is contained in:
Christoph Hagen 2025-01-09 13:27:53 +01:00
parent 0db6e411c3
commit c38d8e0264

View File

@ -244,6 +244,7 @@ struct MainView: App {
return
}
content.loadFromDisk { errors in
prepareAfterLoad()
guard !errors.isEmpty else {
return
}
@ -252,6 +253,21 @@ struct MainView: App {
}
}
private func prepareAfterLoad() {
if selectedPost == nil {
selectedPost = content.posts.first
}
if selectedPage == nil {
selectedPage = content.pages.first
}
if selectedTag == nil {
selectedTag = content.tags.first
}
if selectedFile == nil {
selectedFile = content.files.first
}
}
private func showInitialSheet() {
DispatchQueue.main.async {
selectedSection = .folders