From af9a681b58ea71d0b400c494b79f307c20f60ac0 Mon Sep 17 00:00:00 2001 From: Davis McPhee Date: Fri, 4 Nov 2022 00:19:00 -0300 Subject: [PATCH] [Discover] Improve time range text loading state --- .../unified_histogram/public/chart/use_time_range.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/unified_histogram/public/chart/use_time_range.tsx b/src/plugins/unified_histogram/public/chart/use_time_range.tsx index bb66cffca263f..b12d7f3040a7b 100644 --- a/src/plugins/unified_histogram/public/chart/use_time_range.tsx +++ b/src/plugins/unified_histogram/public/chart/use_time_range.tsx @@ -42,10 +42,6 @@ export const useTimeRange = ({ ); const timeRangeText = useMemo(() => { - if (!bucketInterval) { - return ''; - } - const timeRange = { from: dateMath.parse(from), to: dateMath.parse(to, { roundUp: true }), @@ -60,7 +56,12 @@ export const useTimeRange = ({ defaultMessage: 'Auto', })} - ` : '' - }${bucketInterval.description}`, + }${ + bucketInterval?.description ?? + i18n.translate('unifiedHistogram.histogramTimeRangeIntervalLoading', { + defaultMessage: 'loading...', + }) + }`, }, });