From fd10e25206e3ebde9dc131513c50d3e23fa95c3a Mon Sep 17 00:00:00 2001 From: Joey Ballentine Date: Fri, 21 Jan 2022 09:26:36 -0500 Subject: [PATCH] Hotfix: Fixed number inputs sometimes being NaN Bump version --- package.json | 2 +- src/components/inputs/NumberInput.jsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4d4e02758..bf9f349b8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "chainner", "productName": "chaiNNer", - "version": "0.1.3", + "version": "0.1.4", "description": "A flowchart based image processing GUI", "main": ".webpack/main", "scripts": { diff --git a/src/components/inputs/NumberInput.jsx b/src/components/inputs/NumberInput.jsx index 4a36a3141..1309e1491 100644 --- a/src/components/inputs/NumberInput.jsx +++ b/src/components/inputs/NumberInput.jsx @@ -18,9 +18,9 @@ const NumericalInput = memo(({ const handleChange = (numberAsString, numberAsNumber) => { if (data?.inputs[index]?.type.includes('odd')) { // Make the number odd if need be - setInput(numberAsNumber + (1 - (numberAsNumber % 2))); + setInput(String(numberAsNumber + (1 - (numberAsNumber % 2)))); } else { - setInput(numberAsNumber); + setInput(numberAsString); } }; @@ -32,7 +32,7 @@ const NumericalInput = memo(({ max={max ?? Infinity} precision={precision} placeholder={label} - value={input} + value={String(input) || 0} onChange={handleChange} draggable={false} className="nodrag"