From 23634a664ea06a506e3627e091af405b8acfb177 Mon Sep 17 00:00:00 2001 From: Uladzislau Lasitsa Date: Fri, 25 Sep 2020 17:00:08 +0300 Subject: [PATCH] Fixed useEffect in metric_axes. Update type in params instead of type of vis --- .../public/components/options/metrics_axes/index.tsx | 4 ++-- .../public/components/options/point_series/point_series.tsx | 2 +- src/plugins/vis_type_vislib/public/types.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx index d885f8fb0b12f..8972c979ebdb9 100644 --- a/src/plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx @@ -299,8 +299,8 @@ function MetricsAxisOptions(props: ValidationVisOptionsProps) }, [stateParams.seriesParams]); useEffect(() => { - vis.setState({ ...vis.serialize(), type: visType }); - }, [vis, visType]); + setValue('type', visType); + }, [setValue, visType]); return isTabSelected ? ( <> diff --git a/src/plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx b/src/plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx index a27d0be8018c9..46e73c72b7e22 100644 --- a/src/plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx @@ -68,7 +68,7 @@ function PointSeriesOptions(props: ValidationVisOptionsProps) /> )} - {vis.type.name === ChartTypes.HISTOGRAM && ( + {stateParams.type === ChartTypes.HISTOGRAM && (