Skip to content

Commit

Permalink
Fix loading state sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Oct 14, 2024
1 parent ce1ab00 commit 5f6b405
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,9 @@ export const useDiscoverHistogram = ({
}

const fetchStatus = status.toString() as FetchStatus;
const isSavedSearchLoading =
savedSearchHits$.getValue().fetchStatus === FetchStatus.LOADING;
const isUnifiedHistogramLoading = status === UnifiedHistogramFetchStatus.loading;

// Sync the totalHits$ observable with the unified histogram state unless both are set to loading
if (isSavedSearchLoading !== isUnifiedHistogramLoading) {
// Do not sync the loading state since it's already handled by the saved search
if (fetchStatus !== FetchStatus.LOADING) {
savedSearchHits$.next({
fetchStatus,
result,
Expand Down

0 comments on commit 5f6b405

Please sign in to comment.