[Metrics UI] Handle event.target properly for Legend Controls (#68029)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Chris Cowan 2020-06-04 16:26:45 -07:00 committed by GitHub
parent a4549a71ed
commit 4fde7a69d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -141,14 +141,16 @@ export const LegendControls = ({
const handleStepsChange = useCallback(
(e) => {
setLegendOptions((previous) => ({ ...previous, steps: parseInt(e.target.value, 10) }));
const steps = parseInt(e.target.value, 10);
setLegendOptions((previous) => ({ ...previous, steps }));
},
[setLegendOptions]
);
const handlePaletteChange = useCallback(
(e) => {
setLegendOptions((previous) => ({ ...previous, palette: e.target.value }));
const palette = e.target.value;
setLegendOptions((previous) => ({ ...previous, palette }));
},
[setLegendOptions]
);