Skip to content

Commit

Permalink
Fixed useEffect in metric_axes. Update type in params instead of type…
Browse files Browse the repository at this point in the history
… of vis
  • Loading branch information
VladLasitsa committed Sep 25, 2020
1 parent f2fc48d commit 23634a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ function MetricsAxisOptions(props: ValidationVisOptionsProps<BasicVislibParams>)
}, [stateParams.seriesParams]);

useEffect(() => {
vis.setState({ ...vis.serialize(), type: visType });
}, [vis, visType]);
setValue('type', visType);
}, [setValue, visType]);

return isTabSelected ? (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function PointSeriesOptions(props: ValidationVisOptionsProps<BasicVislibParams>)
/>
)}

{vis.type.name === ChartTypes.HISTOGRAM && (
{stateParams.type === ChartTypes.HISTOGRAM && (
<SwitchOption
data-test-subj="showValuesOnChart"
label={i18n.translate('visTypeVislib.editors.pointSeries.showLabels', {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_type_vislib/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,5 @@ export interface BasicVislibParams extends CommonVislibParams {
};
seriesParams: SeriesParam[];
times: TimeMarker[];
type: string;
}

0 comments on commit 23634a6

Please sign in to comment.