summaryrefslogtreecommitdiff
path: root/Sora
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-09-11 15:00:22 -0700
committerFuwn <[email protected]>2025-09-11 15:00:22 -0700
commit155a855477539ec4914a0be620456e458cf1464e (patch)
treeeaf0f3bf4b6db98e718e061ee757db8eafcb3f68 /Sora
parentfeat: Development commit (diff)
downloadsora-testing-155a855477539ec4914a0be620456e458cf1464e.tar.xz
sora-testing-155a855477539ec4914a0be620456e458cf1464e.zip
feat: Development commit
Diffstat (limited to 'Sora')
-rw-r--r--Sora/Views/MainView.swift4
-rw-r--r--Sora/Views/Post/Grid/PostGridView.swift21
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
+ )
+ }
}
}
}