diff options
| author | Fuwn <[email protected]> | 2025-06-15 05:22:14 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-06-15 05:22:14 -0700 |
| commit | a70349e971e1b6e31642cd3b2e9b15881395e2f9 (patch) | |
| tree | 1a16ad8b517ab325e74bbd4ce811fea8ca32fac5 /Sora/Views/Post/Grid/PostGridView.swift | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-a70349e971e1b6e31642cd3b2e9b15881395e2f9.tar.xz sora-testing-a70349e971e1b6e31642cd3b2e9b15881395e2f9.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Views/Post/Grid/PostGridView.swift')
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridView.swift | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift index 4aa4b39..117da87 100644 --- a/Sora/Views/Post/Grid/PostGridView.swift +++ b/Sora/Views/Post/Grid/PostGridView.swift @@ -69,14 +69,16 @@ struct PostGridView: View { return } - manager.performSearch(settings: settings) + Task(priority: .userInitiated) { + await manager.performSearch(settings: settings) + } } .navigationDestination(for: BooruPost.self) { post in PostDetailsView(post: post) } .onChange(of: isSearchablePresented) { _, isPresented in if !isPresented, manager.searchText.isEmpty, !manager.isNavigatingHistory { - manager.performSearch() + Task(priority: .userInitiated) { await manager.performSearch() } } } .onChange(of: manager.posts) { _, newPosts in @@ -105,11 +107,13 @@ struct PostGridView: View { manager.posts = [] manager.currentPage = 1 - manager.fetchPosts( - page: 1, - tags: manager.searchHistory[newIndex].tags, - replace: true - ) + Task(priority: .userInitiated) { + await manager.fetchPosts( + page: 1, + tags: manager.searchHistory[newIndex].tags, + replace: true + ) + } } } .toolbar { @@ -144,7 +148,13 @@ struct PostGridView: View { } PlatformSpecificToolbarItem { - Button(action: { Task { manager.loadNextPage() } }) { + Button( + action: { + Task(priority: .userInitiated) { + await manager.loadNextPage() + } + } + ) { Label( "Manually Load Next Page", systemImage: "arrow.down.to.line" @@ -176,9 +186,11 @@ struct PostGridView: View { .navigationTitle("Posts") .refreshable { manager.clearCachedPages() - manager.fetchPosts(page: 1, tags: manager.tags, replace: true) + + Task(priority: .userInitiated) { + await manager.fetchPosts(page: 1, tags: manager.tags, replace: true) + } } - .scrollDisabled(manager.isLoading) .sheet(isPresented: $isSearchHistoryPresented) { PostGridSearchHistoryView( selectedTab: $selectedTab, |