From 0fb9e60c3f11b505cfa34dcf92bef0a28e2828f7 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sat, 28 Jan 2023 08:29:49 +0100 Subject: [PATCH] Fix a few issues with search --- .../Explore/Sources/Explore/ExploreView.swift | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Packages/Explore/Sources/Explore/ExploreView.swift b/Packages/Explore/Sources/Explore/ExploreView.swift index f5c11975..eccf2eb0 100644 --- a/Packages/Explore/Sources/Explore/ExploreView.swift +++ b/Packages/Explore/Sources/Explore/ExploreView.swift @@ -22,17 +22,24 @@ public struct ExploreView: View { loadingView } else if !viewModel.searchQuery.isEmpty { if viewModel.isSearching { - HStack {} - .listRowBackground(theme.secondaryBackgroundColor) - .listRowSeparator(.hidden) - } else if let results = viewModel.results[viewModel.searchQuery], !results.isEmpty { - makeSearchResultsView(results: results) - } else { - EmptyView(iconName: "magnifyingglass", - title: "explore.search.empty.title", - message: "explore.search.empty.message") - .listRowBackground(theme.secondaryBackgroundColor) - .listRowSeparator(.hidden) + HStack { + Spacer() + ProgressView() + Spacer() + } + .listRowBackground(theme.secondaryBackgroundColor) + .listRowSeparator(.hidden) + .id(UUID()) + } else if let results = viewModel.results[viewModel.searchQuery] { + if results.isEmpty, !viewModel.isSearching { + EmptyView(iconName: "magnifyingglass", + title: "explore.search.empty.title", + message: "explore.search.empty.message") + .listRowBackground(theme.secondaryBackgroundColor) + .listRowSeparator(.hidden) + } else { + makeSearchResultsView(results: results) + } } } else if viewModel.allSectionsEmpty { EmptyView(iconName: "magnifyingglass",