diff options
| author | Fuwn <[email protected]> | 2025-09-11 15:00:22 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-11 15:00:22 -0700 |
| commit | 155a855477539ec4914a0be620456e458cf1464e (patch) | |
| tree | eaf0f3bf4b6db98e718e061ee757db8eafcb3f68 /Sora | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-155a855477539ec4914a0be620456e458cf1464e.tar.xz sora-testing-155a855477539ec4914a0be620456e458cf1464e.zip | |
feat: Development commit
Diffstat (limited to 'Sora')
| -rw-r--r-- | Sora/Views/MainView.swift | 4 | ||||
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridView.swift | 21 |
2 files changed, 16 insertions, 9 deletions
diff --git a/Sora/Views/MainView.swift b/Sora/Views/MainView.swift index f01a1e6..aa89aa3 100644 --- a/Sora/Views/MainView.swift +++ b/Sora/Views/MainView.swift @@ -13,7 +13,9 @@ struct MainView: View { updateManager(newState) } .onChange(of: manager.historyIndex) { _, _ in - manager.selectedPost = nil + if manager.isNavigatingHistory { + manager.selectedPost = nil + } } .onAppear(perform: initializeManager) .onChange(of: settings.providerCredentials) { initializeManager() } diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift index 518b305..025c3d2 100644 --- a/Sora/Views/Post/Grid/PostGridView.swift +++ b/Sora/Views/Post/Grid/PostGridView.swift @@ -253,14 +253,19 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length await performLocalSearch() } } else { - currentLocalTask = Task(priority: .userInitiated) { - await fetchLocalPosts( - page: 1, - tags: localSearchText.components(separatedBy: .whitespaces).filter { component in - !component.isEmpty - }, - replace: true - ) + let currentTags = localSearchText.components(separatedBy: .whitespaces).filter { !$0.isEmpty } + let hasPosts = !localPosts.isEmpty + let initialTags = initialTag.components(separatedBy: .whitespaces).filter { !$0.isEmpty } + let needsFetch = !hasPosts || currentTags != initialTags + + if needsFetch { + currentLocalTask = Task(priority: .userInitiated) { + await fetchLocalPosts( + page: 1, + tags: currentTags, + replace: true + ) + } } } } |