From 10dba6f0caa5f4c632602ff180960925e48b676b Mon Sep 17 00:00:00 2001 From: Shaurya Sharma <79473274+shaurya-sharma064@users.noreply.github.com> Date: Wed, 31 Jul 2024 09:43:27 +0530 Subject: [PATCH] fix/zero-padding (#10513) * fix/zero-padding * Check for NaN --- frontend/src/Editor/component-properties-validation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/Editor/component-properties-validation.js b/frontend/src/Editor/component-properties-validation.js index 965b355210..6271022c7a 100644 --- a/frontend/src/Editor/component-properties-validation.js +++ b/frontend/src/Editor/component-properties-validation.js @@ -15,7 +15,7 @@ const { } = require('superstruct'); import { validateMultilineCode } from '@/_helpers/utility'; -import _ from 'lodash'; +import _, { isNumber } from 'lodash'; import { reservedKeywordReplacer } from '@/_lib/reserved-keyword-replacer'; export const generateSchemaFromValidationDefinition = (definition, recursionDepth = 0) => { @@ -38,7 +38,7 @@ export const generateSchemaFromValidationDefinition = (definition, recursionDept if (recursionDepth === 0) { schema = coerce(schema, string(), (value) => { const parsedValue = parseFloat(value); - const finalValue = parsedValue ? parsedValue : value; + const finalValue = isNumber(parsedValue) && Number.isFinite(parsedValue) ? parsedValue : value; return finalValue; }); }