Skip to content

Commit

Permalink
Fix some types.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Jun 7, 2022
1 parent b96effc commit 32fc66c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions x-pack/plugins/ux/public/hooks/use_core_web_vitals_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ export function useCoreWebVitalsQuery(uxQuery: ReturnType<typeof useUxQuery>) {
[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 };
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { ESSearchResponse } from '@kbn/core/types/elasticsearch';
import { UXMetrics } from '@kbn/observability-plugin/public';
import {
TBT_FIELD,
FCP_FIELD,
Expand All @@ -32,7 +33,7 @@ const getRanksPercentages = (ranks?: Record<string, number | null>) => {
export function transformCoreWebVitalsResponse<T>(
response?: ESSearchResponse<T, ReturnType<typeof coreWebVitalsQuery>>,
percentile = PERCENTILE_DEFAULT
) {
): UXMetrics | undefined {
if (!response) return response;
const {
lcp,
Expand Down

0 comments on commit 32fc66c

Please sign in to comment.