From e33f154cf2168567ccdf2e7f1abad8b4e9e264b0 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 18 Oct 2023 23:59:48 -0300 Subject: [PATCH] fix(reactflowUtils.ts): modify convertValuesToNumbers function to correctly handle values that are numbers represented as strings feat(reactflowUtils.ts): add check to convertValuesToNumbers function to only convert values that are valid numbers represented as strings --- src/frontend/src/utils/reactflowUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index 5cb549471..6f8ca93fe 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -367,8 +367,8 @@ export function convertValuesToNumbers(arr) { for (const key in obj) { if (obj.hasOwnProperty(key)) { let value = obj[key]; - if (/\s/g.test(value)) { - value = value.trim(); + if (/^\d+$/.test(value)) { + value = value?.toString().trim(); } newObj[key] = value === "" || isNaN(value) ? value.toString() : Number(value);