Fix validation activity indicator (#14730)

* Don't show two spinners when loading/revalidating search results

* clarify
This commit is contained in:
Josh Hawkins 2024-11-01 20:52:00 -05:00 committed by GitHub
parent 1234003527
commit 11068aa9d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -428,9 +428,8 @@ export default function Explore() {
searchTerm={searchTerm}
searchFilter={searchFilter}
searchResults={searchResults}
isLoading={
(isLoadingInitialData || isLoadingMore || isValidating) ?? true
}
isLoading={(isLoadingInitialData || isLoadingMore) ?? true}
isValidating={isValidating}
hasMore={!isReachingEnd}
columns={gridColumns}
defaultView={defaultView}

View File

@ -37,6 +37,7 @@ type SearchViewProps = {
searchFilter?: SearchFilter;
searchResults?: SearchResult[];
isLoading: boolean;
isValidating: boolean;
hasMore: boolean;
columns: number;
defaultView?: string;
@ -55,6 +56,7 @@ export default function SearchView({
searchFilter,
searchResults,
isLoading,
isValidating,
hasMore,
columns,
defaultView = "summary",
@ -397,8 +399,9 @@ export default function SearchView({
</div>
)}
{isLoading &&
(searchTerm ||
{((isLoading && uniqueResults?.length == 0) || // show on initial load
(isValidating && !isLoading)) && // or revalidation
(searchTerm || // or change of filter/search term
(searchFilter && Object.keys(searchFilter).length !== 0)) && (
<ActivityIndicator className="absolute left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2 rounded-2xl bg-background/80 p-3 dark:bg-background/50" />
)}