From 32fc66c58c076ac9935a26de13bdc5daf538211a Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 3 Jun 2022 12:38:15 -0400 Subject: [PATCH] Fix some types. --- .../ux/public/hooks/use_core_web_vitals_query.ts | 14 ++++++++------ .../public/services/data/core_web_vitals_query.ts | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/ux/public/hooks/use_core_web_vitals_query.ts b/x-pack/plugins/ux/public/hooks/use_core_web_vitals_query.ts index 54da010143030..8af6060d498e6 100644 --- a/x-pack/plugins/ux/public/hooks/use_core_web_vitals_query.ts +++ b/x-pack/plugins/ux/public/hooks/use_core_web_vitals_query.ts @@ -32,11 +32,13 @@ export function useCoreWebVitalsQuery(uxQuery: ReturnType) { [uxQuery, dataViewTitle], { name: 'UxCoreWebVitals' } ); - const data = useMemo(() => { - transformCoreWebVitalsResponse( - esQueryResponse, - uxQuery?.percentile ? Number(uxQuery?.percentile) : PERCENTILE_DEFAULT - ); - }, [esQueryResponse, uxQuery?.percentile]); + const data = useMemo( + () => + transformCoreWebVitalsResponse( + esQueryResponse, + uxQuery?.percentile ? Number(uxQuery?.percentile) : PERCENTILE_DEFAULT + ), + [esQueryResponse, uxQuery?.percentile] + ); return { data, loading }; } diff --git a/x-pack/plugins/ux/public/services/data/core_web_vitals_query.ts b/x-pack/plugins/ux/public/services/data/core_web_vitals_query.ts index 1a969c6f37267..506727b315b3e 100644 --- a/x-pack/plugins/ux/public/services/data/core_web_vitals_query.ts +++ b/x-pack/plugins/ux/public/services/data/core_web_vitals_query.ts @@ -6,6 +6,7 @@ */ import { ESSearchResponse } from '@kbn/core/types/elasticsearch'; +import { UXMetrics } from '@kbn/observability-plugin/public'; import { TBT_FIELD, FCP_FIELD, @@ -32,7 +33,7 @@ const getRanksPercentages = (ranks?: Record) => { export function transformCoreWebVitalsResponse( response?: ESSearchResponse>, percentile = PERCENTILE_DEFAULT -) { +): UXMetrics | undefined { if (!response) return response; const { lcp,