From 6b45e1fc707cc83a60fade74789464bf1a52f3d1 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Mon, 14 Oct 2024 12:40:15 +0200 Subject: [PATCH] Update use_discover_histogram.ts --- .../main/components/layout/use_discover_histogram.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/discover/public/application/main/components/layout/use_discover_histogram.ts b/src/plugins/discover/public/application/main/components/layout/use_discover_histogram.ts index f48161f118f85..994bde5babda7 100644 --- a/src/plugins/discover/public/application/main/components/layout/use_discover_histogram.ts +++ b/src/plugins/discover/public/application/main/components/layout/use_discover_histogram.ts @@ -199,12 +199,10 @@ export const useDiscoverHistogram = ({ }); } - const isSavedSearchLoading = - savedSearchHits$.getValue().fetchStatus === FetchStatus.LOADING; - const isUnifiedHistogramLoading = status === UnifiedHistogramFetchStatus.loading; + const fetchStatus = status.toString() as FetchStatus; - // 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,