summaryrefslogtreecommitdiff
path: root/Sora/Views/Post/Grid/PostGridView.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-06-26 07:05:04 -0700
committerFuwn <[email protected]>2025-06-26 07:05:04 -0700
commitbf612d8a54317f94f0be2febd342819192f461f6 (patch)
treeaf38635f016632f7eba57137afce55c098dd57f9 /Sora/Views/Post/Grid/PostGridView.swift
parentfeat: Development commit (diff)
downloadsora-testing-bf612d8a54317f94f0be2febd342819192f461f6.tar.xz
sora-testing-bf612d8a54317f94f0be2febd342819192f461f6.zip
feat: Development commit
Diffstat (limited to 'Sora/Views/Post/Grid/PostGridView.swift')
-rw-r--r--Sora/Views/Post/Grid/PostGridView.swift8
1 files changed, 7 insertions, 1 deletions
diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift
index 4b32c88..33deabc 100644
--- a/Sora/Views/Post/Grid/PostGridView.swift
+++ b/Sora/Views/Post/Grid/PostGridView.swift
@@ -6,7 +6,8 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
@EnvironmentObject var manager: BooruManager
@State private var isSearchHistoryPresented = false
@Binding var selectedTab: Int
- @State private var viewStates: [UUID: PostGridViewState] = [:]
+ @Binding var viewStates: [UUID: PostGridViewState]
+ @Binding var viewStateSelection: UUID?
@State private var isSearchablePresented = false
@State private var cachedSuggestions: [Either<BooruTag, BooruSearchQuery>] = []
@State private var suppressNextSearchSubmit = false
@@ -359,6 +360,7 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
selectedPost: BooruPost? = nil,
resetSelectedPost: Bool = false
) {
+ let wasNewlyCreated = viewStates[queryID] == nil
var state = viewStates[queryID] ?? PostGridViewState()
if !posts.isEmpty { state.posts = posts }
@@ -372,5 +374,9 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
}
viewStates[queryID] = state
+
+ if wasNewlyCreated {
+ viewStateSelection = queryID
+ }
}
}