From f16a2c0f48fde1e22ab1ee227007b910fce446b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=A4ggmark?= Date: Tue, 15 Jan 2019 19:45:46 +0100 Subject: [PATCH] Fixed NaN issue when parsing --- .../src/components/ThresholdsEditor/ThresholdsEditor.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx b/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx index 87845dedd7a..9fee8025ec3 100644 --- a/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx +++ b/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx @@ -95,10 +95,12 @@ export class ThresholdsEditor extends PureComponent { } const { thresholds } = this.state; + const parsedValue = parseInt(event.target.value, 10); + const value = isNaN(parsedValue) ? null : parsedValue; const newThresholds = thresholds.map(t => { if (t === threshold) { - t = { ...t, value: parseInt(event.target.value, 10) }; + t = { ...t, value: value as number }; } return t;