mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix validation activity indicator (#14730)
* Don't show two spinners when loading/revalidating search results * clarify
This commit is contained in:
parent
1234003527
commit
11068aa9d0
@ -428,9 +428,8 @@ export default function Explore() {
|
|||||||
searchTerm={searchTerm}
|
searchTerm={searchTerm}
|
||||||
searchFilter={searchFilter}
|
searchFilter={searchFilter}
|
||||||
searchResults={searchResults}
|
searchResults={searchResults}
|
||||||
isLoading={
|
isLoading={(isLoadingInitialData || isLoadingMore) ?? true}
|
||||||
(isLoadingInitialData || isLoadingMore || isValidating) ?? true
|
isValidating={isValidating}
|
||||||
}
|
|
||||||
hasMore={!isReachingEnd}
|
hasMore={!isReachingEnd}
|
||||||
columns={gridColumns}
|
columns={gridColumns}
|
||||||
defaultView={defaultView}
|
defaultView={defaultView}
|
||||||
|
@ -37,6 +37,7 @@ type SearchViewProps = {
|
|||||||
searchFilter?: SearchFilter;
|
searchFilter?: SearchFilter;
|
||||||
searchResults?: SearchResult[];
|
searchResults?: SearchResult[];
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
|
isValidating: boolean;
|
||||||
hasMore: boolean;
|
hasMore: boolean;
|
||||||
columns: number;
|
columns: number;
|
||||||
defaultView?: string;
|
defaultView?: string;
|
||||||
@ -55,6 +56,7 @@ export default function SearchView({
|
|||||||
searchFilter,
|
searchFilter,
|
||||||
searchResults,
|
searchResults,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
isValidating,
|
||||||
hasMore,
|
hasMore,
|
||||||
columns,
|
columns,
|
||||||
defaultView = "summary",
|
defaultView = "summary",
|
||||||
@ -397,8 +399,9 @@ export default function SearchView({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isLoading &&
|
{((isLoading && uniqueResults?.length == 0) || // show on initial load
|
||||||
(searchTerm ||
|
(isValidating && !isLoading)) && // or revalidation
|
||||||
|
(searchTerm || // or change of filter/search term
|
||||||
(searchFilter && Object.keys(searchFilter).length !== 0)) && (
|
(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" />
|
<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" />
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user